FormsAuthentication.SlidingExpiration Property

Definition

Gets a value indicating whether sliding expiration is enabled.

C#
public static bool SlidingExpiration { get; }

Property Value

true if sliding expiration is enabled; otherwise, false. The default is true.

Examples

The following code example sets the slidingExpiration attribute to false in the Web.config file for an ASP.NET application.

<authentication mode="Forms">
  <forms loginUrl="member_login.aspx"
    name=".ASPXFORMSAUTH"
    cookieless="UseCookies"
    requireSSL="true"
    slidingExpiration="false" />
</authentication>

Remarks

The SlidingExpiration property value is set using the slidingExpiration attribute of the forms configuration element.

Sliding expiration resets the expiration time for a valid authentication cookie if a request is made and more than half of the timeout interval has elapsed. If the cookie expires, the user must re-authenticate. Setting the SlidingExpiration property to false can improve the security of an application by limiting the time for which an authentication cookie is valid, based on the configured timeout value.

We recommend that if you configure requireSSL as false, you also configure slidingExpiration as false, to reduce the amount of time for which a ticket is valid.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also