当前位置: 首页>>代码示例>>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;未经允许,请勿转载。