Export (0) Print
Expand All

FormsAuthentication.GetAuthCookie Method (String, Boolean)

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.

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

public static HttpCookie GetAuthCookie (
	string userName,
	bool createPersistentCookie
)
public static HttpCookie GetAuthCookie (
	String userName, 
	boolean createPersistentCookie
)
public static function GetAuthCookie (
	userName : String, 
	createPersistentCookie : boolean
) : HttpCookie
Not applicable.

Parameters

userName

The name of the authenticated user.

createPersistentCookie

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

Return Value

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

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

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft