This documentation is archived and is not being maintained.
FormsAuthentication.FormsCookieName Property
.NET Framework 1.1
Returns the configured cookie name used for the current application.
[Visual Basic] Public Shared ReadOnly Property FormsCookieName As String [C#] public static string FormsCookieName {get;} [C++] public: __property static String* get_FormsCookieName(); [JScript] public static function get FormsCookieName() : String;
Property Value
A string containing the configured cookie name used for the current application.
Remarks
Returns a String.
Example
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="true"%> <script runat="server"> Sub Page_Load(sender as Object, e as EventArgs) If Not IsPostBack Then CookieName.Text = FormsAuthentication.FormsCookieName CookiePath.Text = FormsAuthentication.FormsCookiePath CookieSSL.Text = FormsAuthentication.RequireSSL.ToString() CookieExpiration.Text = FormsAuthentication.SlidingExpiration.ToString() End If End Sub </script> <html> <head> </head> <body> <form runat="server"> <h2>Current FormsAuthentication Property Settings</h2> <table width="90%" align="center" cellpadding="3" border="1"> <tr><th>Property</th><th>Current Value</th><th>Default Web.config Setting</th></tr> <tr> <td>FormsCookieName</td> <td><asp:Label id="CookieName" runat="server" /> </td> <td rowspan="4"> <forms <br> name=".ASPXAUTH" <br> path="/" <br> requireSSL="true" <br> slidingExpiration="true" > <br></forms> </td> </tr> <tr> <td>FormsCookiePath</td> <td><asp:Label id="CookiePath" runat="server" /> </td> </tr> <tr> <td>RequireSSL</td> <td><asp:Label id="CookieSSL" runat="server" /> </td> </tr> <tr> <td>SlidingExpiration</td> <td><asp:Label id="CookieExpiration" runat="server" /> </td> </tr> </table> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="true"%> <script runat="server"> private void Page_Load(object Sender, EventArgs e) { if (!IsPostBack) { CookieName.Text = FormsAuthentication.FormsCookieName; CookiePath.Text = FormsAuthentication.FormsCookiePath; CookieSSL.Text = FormsAuthentication.RequireSSL.ToString(); CookieExpiration.Text = FormsAuthentication.SlidingExpiration.ToString(); } } </script> <html> <head> </head> <body> <form runat="server"> <table width="90%" align="center" cellpadding="3" border="1"> <tr><th>Property</th><th>Current Value</th><th>Configuration Setting</th></tr> <tr> <td>FormsCookieName</td> <td><asp:Label id="CookieName" runat="server" /> </td> <td rowspan="4"> <forms <br> name=".ASPXAUTH" <br> path="/" <br> requireSSL="true" <br> slidingExpiration="true" <br>><br></forms> </td> </tr> <tr> <td>FormsCookiePath</td> <td><asp:Label id="CookiePath" runat="server" /> </td> </tr> <tr> <td>RequireSSL</td> <td><asp:Label id="CookieSSL" runat="server" /> </td> </tr> <tr> <td>SlidingExpiration</td> <td><asp:Label id="CookieExpiration" runat="server" /> </td> </tr> </table> </form> </body> </html>
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
FormsAuthentication Class | FormsAuthentication Members | System.Web.Security Namespace
Show: