What is slidingExpiration attribute in ASP.Net?

andy - 11 May, 2016 10331 Views 0 Comment

The slidingExpiration attribute is used in ASP.Net form authentication. This property is used to reset the expiration time for a valid authentication cookie if a request that has already being made has passed the timeout interval. Which means, if it is already expires, the current user will require to re-authentication again.

What is the recommendation value for slidingExpiration?

The slidingExpiration period is only accepting true or false value. It is recommended that you use false as default value, this is a good option to improve the security of your site. It will eliminate any unused session and force your users to re-login again if their current session is not active.

How to set the slidingExpiration value?

This setting is located under your web configuration file (web.config), if you do not find this configuration section, please insert it under system.web section. See below example for more details.

<authentication mode="Forms">
  <forms loginUrl="login.aspx"
    slidingExpiration="false" />


There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.

Related Articles

How to remove html tags from string in c#?

Sometimes you need to remove HTML tags from string to ensure there are no dangerous or malicious scripts especially when you want to store the string or data text into the database.