當前位置: 首頁>>代碼示例>>C#>>正文


C# HttpContextBase.GetNWebsecContext方法代碼示例

本文整理匯總了C#中System.Web.HttpContextBase.GetNWebsecContext方法的典型用法代碼示例。如果您正苦於以下問題:C# HttpContextBase.GetNWebsecContext方法的具體用法?C# HttpContextBase.GetNWebsecContext怎麽用?C# HttpContextBase.GetNWebsecContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Web.HttpContextBase的用法示例。


在下文中一共展示了HttpContextBase.GetNWebsecContext方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetContentRelatedHeadersFromConfig

 internal void SetContentRelatedHeadersFromConfig(HttpContextBase context)
 {
     var nwebsecContext = context.GetNWebsecContext();
     SetXXssProtectionHeader(context, nwebsecContext);
     SetCspHeaders(context, nwebsecContext, false);
     SetCspHeaders(context, nwebsecContext, true);
     SetNoCacheHeadersFromConfig(context, nwebsecContext);
 }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:8,代碼來源:ConfigurationHeaderSetter.cs

示例2: GetCspReportonlyConfiguration

 private ICspConfiguration GetCspReportonlyConfiguration(HttpContextBase context)
 {
     var owinContext = context.GetNWebsecOwinContext();
     if (owinContext != null && owinContext.CspReportOnly != null)
     {
         return owinContext.CspReportOnly;
     }
     return context.GetNWebsecContext().CspReportOnly;
 }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:9,代碼來源:ContextConfigurationHelper.cs

示例3: GetXXssProtectionConfiguration

 public IXXssProtectionConfiguration GetXXssProtectionConfiguration(HttpContextBase context)
 {
     var owinContext = context.GetNWebsecOwinContext();
     if (owinContext != null && owinContext.XXssProtection != null)
     {
         return owinContext.XXssProtection;
     }
     return context.GetNWebsecContext().XXssProtection;
 }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:9,代碼來源:ContextConfigurationHelper.cs

示例4: GetXDownloadOptionsConfiguration

 public ISimpleBooleanConfiguration GetXDownloadOptionsConfiguration(HttpContextBase context)
 {
     var owinContext = context.GetNWebsecOwinContext();
     if (owinContext != null && owinContext.XDownloadOptions != null)
     {
         return owinContext.XDownloadOptions;
     }
     return context.GetNWebsecContext().XDownloadOptions;
 }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:9,代碼來源:ContextConfigurationHelper.cs

示例5: GetXFrameOptionsConfiguration

 public IXFrameOptionsConfiguration GetXFrameOptionsConfiguration(HttpContextBase context)
 {
     var owinContext = context.GetNWebsecOwinContext();
     if (owinContext != null && owinContext.XFrameOptions != null)
     {
         return owinContext.XFrameOptions;
     }
     return context.GetNWebsecContext().XFrameOptions;
 }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:9,代碼來源:ContextConfigurationHelper.cs

示例6: GetXRobotsTagConfiguration

 public IXRobotsTagConfiguration GetXRobotsTagConfiguration(HttpContextBase context)
 {
     var owinContext = context.GetNWebsecOwinContext();
     if (owinContext != null && owinContext.XRobotsTag != null)
     {
         return owinContext.XRobotsTag;
     }
     return context.GetNWebsecContext().XRobotsTag;
 }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:9,代碼來源:ContextConfigurationHelper.cs

示例7: SetSitewideHeadersFromConfig

 internal void SetSitewideHeadersFromConfig(HttpContextBase context)
 {
     var nwebsecContext = context.GetNWebsecContext();
     SetHstsHeader(context.Response, context.Request.IsSecureConnection, _cspUpgradeRequestHelper.UaSupportsUpgradeInsecureRequests(context.Request));
     SetHpkpHeader(context.Response, context.Request.IsSecureConnection, false);
     SetHpkpHeader(context.Response, context.Request.IsSecureConnection, true);
     SetXRobotsTagHeader(context.Response, nwebsecContext);
     SetXFrameoptionsHeader(context.Response, nwebsecContext);
     SetXContentTypeOptionsHeader(context.Response, nwebsecContext);
     SetXDownloadOptionsHeader(context.Response, nwebsecContext);
 }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:11,代碼來源:ConfigurationHeaderSetter.cs

示例8: GetCspConfiguration

        public ICspConfiguration GetCspConfiguration(HttpContextBase context, bool reportOnly)
        {
            if (reportOnly)
            {
                return GetCspReportonlyConfiguration(context);
            }

            var owinContext = context.GetNWebsecOwinContext();
            if (owinContext != null && owinContext.Csp != null)
            {
                return owinContext.Csp;
            }
            return context.GetNWebsecContext().Csp;
        }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:14,代碼來源:ContextConfigurationHelper.cs

示例9: GetCspConfigurationOverride

        public CspOverrideConfiguration GetCspConfigurationOverride(HttpContextBase httpContext, bool reportOnly, bool allowNull)
        {
            var context = httpContext.GetNWebsecOwinContext() ?? httpContext.GetNWebsecContext();
            var configOverride = GetConfigOverrides(context);

            if (allowNull)
            {
                return (reportOnly ? configOverride.CspReportOnlyOverride : configOverride.CspOverride) as CspOverrideConfiguration;
            }

            if (reportOnly)
            {
                if (configOverride.CspReportOnlyOverride == null)
                {
                    configOverride.CspReportOnlyOverride = new CspOverrideConfiguration();
                }
                return configOverride.CspReportOnlyOverride as CspOverrideConfiguration;
            }

            if (configOverride.CspOverride == null)
            {
                configOverride.CspOverride = new CspOverrideConfiguration();
            }
            return configOverride.CspOverride as CspOverrideConfiguration;
        }
開發者ID:modulexcite,項目名稱:NWebsec,代碼行數:25,代碼來源:ContextConfigurationHelper.cs


注:本文中的System.Web.HttpContextBase.GetNWebsecContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。