共用方式為


CookiePolicyOptionsExtensions.HandleSameSiteCookieCompatibility Method

Definition

Overloads

HandleSameSiteCookieCompatibility(CookiePolicyOptions)

Handles SameSite cookies according to the ASP.NET Core documentation at https://learn.microsoft.com/aspnet/core/security/samesite. The default list of user agents that disallow "SameSite=None", was taken from https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/.

HandleSameSiteCookieCompatibility(CookiePolicyOptions, Func<String,Boolean>)

Handles SameSite cookies according to the ASP.NET Core documentation at https://learn.microsoft.com/aspnet/core/security/samesite. The default list of user agents that disallow "SameSite=None", was taken from https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/.

HandleSameSiteCookieCompatibility(CookiePolicyOptions)

Handles SameSite cookies according to the ASP.NET Core documentation at https://learn.microsoft.com/aspnet/core/security/samesite. The default list of user agents that disallow "SameSite=None", was taken from https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/.

public static Microsoft.AspNetCore.Builder.CookiePolicyOptions HandleSameSiteCookieCompatibility (this Microsoft.AspNetCore.Builder.CookiePolicyOptions options);
static member HandleSameSiteCookieCompatibility : Microsoft.AspNetCore.Builder.CookiePolicyOptions -> Microsoft.AspNetCore.Builder.CookiePolicyOptions
<Extension()>
Public Function HandleSameSiteCookieCompatibility (options As CookiePolicyOptions) As CookiePolicyOptions

Parameters

Returns

CookiePolicyOptions to chain.

Applies to

HandleSameSiteCookieCompatibility(CookiePolicyOptions, Func<String,Boolean>)

Handles SameSite cookies according to the ASP.NET Core documentation at https://learn.microsoft.com/aspnet/core/security/samesite. The default list of user agents that disallow "SameSite=None", was taken from https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/.

public static Microsoft.AspNetCore.Builder.CookiePolicyOptions HandleSameSiteCookieCompatibility (this Microsoft.AspNetCore.Builder.CookiePolicyOptions options, Func<string,bool> disallowsSameSiteNone);
static member HandleSameSiteCookieCompatibility : Microsoft.AspNetCore.Builder.CookiePolicyOptions * Func<string, bool> -> Microsoft.AspNetCore.Builder.CookiePolicyOptions
<Extension()>
Public Function HandleSameSiteCookieCompatibility (options As CookiePolicyOptions, disallowsSameSiteNone As Func(Of String, Boolean)) As CookiePolicyOptions

Parameters

disallowsSameSiteNone
Func<String,Boolean>

If you don't want to use the default user agent list implementation, the method sent in this parameter will be run against the user agent and if returned true, SameSite value will be set to Unspecified. The default user agent list used can be found at: https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/.

Returns

CookiePolicyOptions to chain.

Applies to