FormsAuthentication::GetAuthCookie Method (String^, Boolean, String^)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates an authentication cookie for a given user name. This does not set the cookie as part of the outgoing response.

Namespace:   System.Web.Security
Assembly:  System.Web (in System.Web.dll)

public:
static HttpCookie^ GetAuthCookie(
	String^ userName,
	bool createPersistentCookie,
	String^ strCookiePath
)

Parameters

userName
Type: System::String^

The name of the authenticated user.

createPersistentCookie
Type: System::Boolean

true to create a durable cookie (one that is saved across browser sessions); otherwise, false.

strCookiePath
Type: System::String^

The Path of the authentication cookie.

Return Value

Type: System.Web::HttpCookie^

An HttpCookie that contains encrypted forms-authentication ticket information.

.NET Framework
Available since 1.1
Return to top
Show: