本文整理汇总了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);
}
示例2: GetCspReportonlyConfiguration
private ICspConfiguration GetCspReportonlyConfiguration(HttpContextBase context)
{
var owinContext = context.GetNWebsecOwinContext();
if (owinContext != null && owinContext.CspReportOnly != null)
{
return owinContext.CspReportOnly;
}
return context.GetNWebsecContext().CspReportOnly;
}
示例3: GetXXssProtectionConfiguration
public IXXssProtectionConfiguration GetXXssProtectionConfiguration(HttpContextBase context)
{
var owinContext = context.GetNWebsecOwinContext();
if (owinContext != null && owinContext.XXssProtection != null)
{
return owinContext.XXssProtection;
}
return context.GetNWebsecContext().XXssProtection;
}
示例4: GetXDownloadOptionsConfiguration
public ISimpleBooleanConfiguration GetXDownloadOptionsConfiguration(HttpContextBase context)
{
var owinContext = context.GetNWebsecOwinContext();
if (owinContext != null && owinContext.XDownloadOptions != null)
{
return owinContext.XDownloadOptions;
}
return context.GetNWebsecContext().XDownloadOptions;
}
示例5: GetXFrameOptionsConfiguration
public IXFrameOptionsConfiguration GetXFrameOptionsConfiguration(HttpContextBase context)
{
var owinContext = context.GetNWebsecOwinContext();
if (owinContext != null && owinContext.XFrameOptions != null)
{
return owinContext.XFrameOptions;
}
return context.GetNWebsecContext().XFrameOptions;
}
示例6: GetXRobotsTagConfiguration
public IXRobotsTagConfiguration GetXRobotsTagConfiguration(HttpContextBase context)
{
var owinContext = context.GetNWebsecOwinContext();
if (owinContext != null && owinContext.XRobotsTag != null)
{
return owinContext.XRobotsTag;
}
return context.GetNWebsecContext().XRobotsTag;
}
示例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);
}
示例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;
}
示例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;
}