FormsAuthentication.GetAuthCookie 方法

定義

建立指定使用者名稱的驗證 Cookie。

多載

GetAuthCookie(String, Boolean)

建立指定使用者名稱的驗證 Cookie。 這不會設定 Cookie 成為連出回應的一部分,因此應用程式更能夠控制如何發出 Cookie。

GetAuthCookie(String, Boolean, String)

建立指定使用者名稱的驗證 Cookie。 這不會將 Cookie 設定為外送回應的一部分。

GetAuthCookie(String, Boolean)

建立指定使用者名稱的驗證 Cookie。 這不會設定 Cookie 成為連出回應的一部分,因此應用程式更能夠控制如何發出 Cookie。

public:
 static System::Web::HttpCookie ^ GetAuthCookie(System::String ^ userName, bool createPersistentCookie);
public static System.Web.HttpCookie GetAuthCookie (string userName, bool createPersistentCookie);
static member GetAuthCookie : string * bool -> System.Web.HttpCookie
Public Shared Function GetAuthCookie (userName As String, createPersistentCookie As Boolean) As HttpCookie

參數

userName
String

已驗證使用者的名稱。

createPersistentCookie
Boolean

true 表示建立持久性 Cookie (跨瀏覽器工作階段儲存的 Cookie),否則為 false

傳回

HttpCookie

HttpCookie,其中包含已加密的表單驗證票證資訊。 使用 FormsCookiePath 屬性的預設值。

備註

Cookie 的路徑是由 屬性決定 FormsCookiePath

另請參閱

適用於

GetAuthCookie(String, Boolean, String)

建立指定使用者名稱的驗證 Cookie。 這不會將 Cookie 設定為外送回應的一部分。

public:
 static System::Web::HttpCookie ^ GetAuthCookie(System::String ^ userName, bool createPersistentCookie, System::String ^ strCookiePath);
public static System.Web.HttpCookie GetAuthCookie (string userName, bool createPersistentCookie, string strCookiePath);
static member GetAuthCookie : string * bool * string -> System.Web.HttpCookie
Public Shared Function GetAuthCookie (userName As String, createPersistentCookie As Boolean, strCookiePath As String) As HttpCookie

參數

userName
String

已驗證使用者的名稱。

createPersistentCookie
Boolean

true 表示建立持久性 Cookie (跨瀏覽器工作階段儲存的 Cookie),否則為 false

strCookiePath
String

驗證 Cookie 的 Path

傳回

HttpCookie

HttpCookie,其中包含已加密的表單驗證票證資訊。

另請參閱

適用於