Programatically Accessing the Forms Authentication Timout from the web.config

I’ve been working on creating a session time out popup for our upcoming portal release.  While I wanted to run the script through my own javascript, I had a little trouble finding the actual property.  Eventually I found a dead page cached with the code that will retrieve the Forms Authentication Timout variable.  I’m reposting the code for prosperities sake.

The code looks something like this:

using System.Web.Configuration;

public double GetTimout()


Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
AuthenticationSection authentication = (AuthenticationSection)config.GetSection("system.web/authentication" );

return authentication.Forms.Timeout.TotalMinutes;


October 4, 2010 • Tags: , , , • Posted in: Technology

Leave a Reply