本文整理匯總了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;
}