Exemple #1
0
        private void HandleResource(string requestResource, IHttpContextProxy httpProxy)
        {
            if (string.IsNullOrEmpty(requestResource) || requestResource == "/")
            {
                requestResource = defaultResourceName;
            }
            string filePath = string.Format("{0}/../wwwroot/appinstall/{1}", ApplicationConfig.AppBinPath, requestResource);

            if (File.Exists(filePath))
            {
                var fileData = File.ReadAllBytes(filePath);
                httpProxy.SetResponse(CommonConst._200_OK, fileData);
            }
            else
            {
                _logger.Error(string.Format("File not found : {0}", filePath));
                httpProxy.SetResponse(CommonConst._404_RESOURCE_NOT_FOUND);
            }

            httpProxy.ContentType = httpProxy.GetMimeType(requestResource);
        }