Export (0) Print
Expand All

FormsAuthentication.SlidingExpiration Property

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Gets a value indicating whether sliding expiration is enabled.

[Visual Basic]
Public Shared ReadOnly Property SlidingExpiration As Boolean
[C#]
public static bool SlidingExpiration {get;}
[C++]
public: __property static bool get_SlidingExpiration();
[JScript]
public static function get SlidingExpiration() : Boolean;

Property Value

true if sliding expiration is enabled; otherwise, false.

Remarks

Sliding expiration resets an active authentication cookie's time to expiration upon each request during a single session.

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">
            &lt;forms
            <br>&nbsp;&nbsp; name=".ASPXAUTH" 
            <br>&nbsp;&nbsp; path="/" 
            <br>&nbsp;&nbsp; requireSSL="true"
            <br>&nbsp;&nbsp; slidingExpiration="true"
            &gt;
            <br>&lt;/forms&gt;
        </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">
            &lt;forms
            <br>&nbsp;&nbsp; name=".ASPXAUTH" 
            <br>&nbsp;&nbsp; path="/" 
            <br>&nbsp;&nbsp; requireSSL="true"
            <br>&nbsp;&nbsp; slidingExpiration="true"
            <br>&gt;<br>&lt;/forms&gt;
        </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 Language Filter 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:
© 2014 Microsoft