Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default expiration time for Session?
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Default expiration time for Session?
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01340515
Message ID:
01340515
Views:
43
Hi everybody,

In our master page I see the following code
private void LoadExpiresScript()
    {
        FormsAuthenticationTicket Athen = (FormsAuthenticationTicket)((FormsIdentity)this.Page.User.Identity).Ticket;

        if (!Athen.IsPersistent)
        {
            //Athen.Expiration = DateTime.Now.AddHours(12);
            TimeSpan TimeLeft = Athen.Expiration - DateTime.Now;
            double TimeOutMil = TimeLeft.TotalMilliseconds - 10000;

          
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "AuthenticationTimeOut",
                @"var defaultTimeOutMilliseconds = " + Convert.ToInt32(TimeOutMil).ToString() + @";
      
var TimeOutId;

    setupTimeout(defaultTimeOutMilliseconds);

function displayAlert(){alert(""As a security precaution, your Friendship Circle Administration session is about to end. Due to inactivity."");
top.location=""" + FormsAuthentication.LoginUrl + "?ReturnUrl=" + Server.UrlEncode(Request.Url.PathAndQuery) +
            @""";
setupTimeout(defaultTimeOutMilliseconds);
}
function setupTimeout(timeOutMilliseconds)
{
    TimeOutId = window.setTimeout('displayAlert()', timeOutMilliseconds);
}
function ResetTimeOut()
{
    window.clearTimeout(TimeOutId);
    setupTimeout(defaultTimeOutMilliseconds);
}", true);
        }
    }
When I was testing it I noticed that the Expiration time was set for ~30 minutes after I started my session. I'm guessing it's some default setting. How and where can I adjust it and what are the consequences of making this time bigger?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform