System.Web.Security.FormsAuthentication.GetAuthCookie Method

Creates an authentication cookie for a given user name. This does not set the cookie as part of the outgoing response, so that an application can have more control over how the cookie is issued.

Syntax

public static System.Web.HttpCookie GetAuthCookie (string userName, bool createPersistentCookie)

Parameters

userName
The name of the authenticated user.
createPersistentCookie
true to create a durable cookie (one that is saved across browser sessions); otherwise, false.

Returns

An System.Web.HttpCookie that contains encrypted forms-authentication ticket information. The default value for the FormsAuthentication.FormsCookiePath property is used.

Remarks

The path of the cookie is determined by the FormsAuthentication.FormsCookiePath property.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0