Exemple #1
0
        internal void SetHstsHeader(HttpResponseBase response, bool isHttps)
        {
            if (!isHttps && WebConfig.SecurityHttpHeaders.Hsts.HttpsOnly)
            {
                return;
            }

            var result = _headerGenerator.CreateHstsResult(WebConfig.SecurityHttpHeaders.Hsts);

            _headerResultHandler.HandleHeaderResult(response, result);
        }
        internal void SetHstsHeader(IHttpContextWrapper httpContext, bool isHttps, bool upgradeSupported)
        {
            if (!isHttps && WebConfig.SecurityHttpHeaders.Hsts.HttpsOnly)
            {
                return;
            }

            if (!upgradeSupported && WebConfig.SecurityHttpHeaders.Hsts.UpgradeInsecureRequests)
            {
                return;
            }

            var result = _headerGenerator.CreateHstsResult(WebConfig.SecurityHttpHeaders.Hsts);

            _headerResultHandler.HandleHeaderResult(httpContext, result);
        }
Exemple #3
0
        public void SetXRobotsTagHeader(HttpContext context)
        {
            var config = _headerConfigurationOverrideHelper.GetXRobotsTagWithOverride(context);

            if (config == null)
            {
                return;
            }

            var oldConfig = _contextConfigurationHelper.GetXRobotsTagConfiguration(context);

            var result = _headerGenerator.CreateXRobotsTagResult(config, oldConfig);

            _headerResultHandler.HandleHeaderResult(context.Response, result);
        }