Export (0) Print
Expand All

FormsAuthentication.SetAuthCookie Method (String, Boolean, String)

.NET Framework 1.1

Creates an authentication ticket for the given userName, createPersistentCookie, and strCookiePath and attaches it to the cookie's collection of the outgoing response. It does not perform a redirect.

[Visual Basic]
Overloads Public Shared Sub SetAuthCookie( _
   ByVal userName As String, _
   ByVal createPersistentCookie As Boolean, _
   ByVal strCookiePath As String _
)
[C#]
public static void SetAuthCookie(
 string userName,
 bool createPersistentCookie,
 string strCookiePath
);
[C++]
public: static void SetAuthCookie(
 String* userName,
 bool createPersistentCookie,
 String* strCookiePath
);
[JScript]
public static function SetAuthCookie(
   userName : String,
 createPersistentCookie : Boolean,
 strCookiePath : String
);

Parameters

userName
The name of an authenticated user. This does not have to map to a Windows account.
createPersistentCookie
Specifies whether or not a durable cookie (one that is saved across browser sessions) should be issued.
strCookiePath
Specifies cookie path.

Remarks

This has the effect of creating an authenticated user. Applications can use this when they intend to manually redirect, or if they do not want to redirect. For example, you can use this for an embedded logon area on a page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

FormsAuthentication Class | FormsAuthentication Members | System.Web.Security Namespace | FormsAuthentication.SetAuthCookie Overload List

Show:
© 2015 Microsoft