Class HttpResponseHeadersExtensions
Extensions for setting response headers.
Inheritance
Inherited Members
Namespace: Lib.AspNetCore.Security.Http.Extensions
Assembly: Lib.AspNetCore.Security.dll
Syntax
public static class HttpResponseHeadersExtensions
Methods
SetClearSiteData(HttpResponse, ClearSiteDataHeaderValue)
Sets the Clear-Site-Data header value.
Declaration
public static void SetClearSiteData(this HttpResponse response, ClearSiteDataHeaderValue clearSiteData)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
ClearSiteDataHeaderValue | clearSiteData | The Clear-Site-Data header value. |
SetExpectCt(HttpResponse, ExpectCtHeaderValue)
Sets the Expect-CT header value.
Declaration
public static void SetExpectCt(this HttpResponse response, ExpectCtHeaderValue expectCt)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
ExpectCtHeaderValue | expectCt | The Expect-CT header value. |
SetFeaturePolicy(HttpResponse, FeaturePolicyHeaderValue)
Sets the Feature-Policy header value.
Declaration
[Obsolete("Feature Policy has been replaced with Permissions Policy.")]
public static void SetFeaturePolicy(this HttpResponse response, FeaturePolicyHeaderValue featurePolicy)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
FeaturePolicyHeaderValue | featurePolicy | The Feature-Policy header value. |
SetPermissionsPolicy(HttpResponse, PermissionsPolicyHeaderValue)
Sets the Permissions-Policy header value.
Declaration
public static void SetPermissionsPolicy(this HttpResponse response, PermissionsPolicyHeaderValue permissionsPolicy)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
PermissionsPolicyHeaderValue | permissionsPolicy | The Permissions-Policy header value. |
SetReferrerPolicy(HttpResponse, ReferrerPolicyDirectives)
Sets the Referrer-Policy header value.
Declaration
public static void SetReferrerPolicy(this HttpResponse response, ReferrerPolicyDirectives directive)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
ReferrerPolicyDirectives | directive | The directive. |
SetReferrerPolicy(HttpResponse, ReferrerPolicyHeaderValue)
Sets the Referrer-Policy header value.
Declaration
public static void SetReferrerPolicy(this HttpResponse response, ReferrerPolicyHeaderValue referrerPolicy)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
ReferrerPolicyHeaderValue | referrerPolicy | The Referrer-Policy header value. |
SetStrictTransportSecurity(HttpResponse, StrictTransportSecurityHeaderValue)
Sets the HTTP Strict Transport Security header value.
Declaration
public static void SetStrictTransportSecurity(this HttpResponse response, StrictTransportSecurityHeaderValue hsts)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
StrictTransportSecurityHeaderValue | hsts | The HTTP Strict Transport Security header value. |
SetWildcardClearSiteData(HttpResponse)
Sets the Clear-Site-Data header value with wildcard pseudotype which indicates that all data types supported by header should be cleared (this is forward-compatible).
Declaration
public static void SetWildcardClearSiteData(this HttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
SetXContentTypeOptions(HttpResponse)
Sets the X-Content-Type-Options header.
Declaration
public static void SetXContentTypeOptions(this HttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
SetXDownloadOptions(HttpResponse)
Sets the X-Download-Options header.
Declaration
public static void SetXDownloadOptions(this HttpResponse response)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
SetXFrameOptions(HttpResponse, XFrameOptionsHeaderValue)
Sets the X-Frame-Options header value.
Declaration
public static void SetXFrameOptions(this HttpResponse response, XFrameOptionsHeaderValue xFrameOptions)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
XFrameOptionsHeaderValue | xFrameOptions | The X-Frame-Options header value. |
SetXPermittedCrossDomainPolicies(HttpResponse, XPermittedCrossDomainPoliciesDirectives)
Sets the X-Permitted-Cross-Domain-Policies header value.
Declaration
public static void SetXPermittedCrossDomainPolicies(this HttpResponse response, XPermittedCrossDomainPoliciesDirectives directive)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
XPermittedCrossDomainPoliciesDirectives | directive | The directive. |
SetXPermittedCrossDomainPolicies(HttpResponse, XPermittedCrossDomainPoliciesHeaderValue)
Sets the X-Permitted-Cross-Domain-Policies header value.
Declaration
public static void SetXPermittedCrossDomainPolicies(this HttpResponse response, XPermittedCrossDomainPoliciesHeaderValue permittedCrossDomainPolicies)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
XPermittedCrossDomainPoliciesHeaderValue | permittedCrossDomainPolicies | The X-Permitted-Cross-Domain-Policies header value. |
SetXXssProtection(HttpResponse, XssFilteringModes)
Sets the X-XSS-Protection header value.
Declaration
public static void SetXXssProtection(this HttpResponse response, XssFilteringModes filteringMode)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
XssFilteringModes | filteringMode | The filtering mode. |
SetXXssProtection(HttpResponse, XXssProtectionHeaderValue)
Sets the X-XSS-Protection header value.
Declaration
public static void SetXXssProtection(this HttpResponse response, XXssProtectionHeaderValue xXssProtection)
Parameters
Type | Name | Description |
---|---|---|
HttpResponse | response | The response. |
XXssProtectionHeaderValue | xXssProtection | The X-XSS-Protection header value. |