Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Default expiration time for Session?
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Default expiration time for Session?
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01340515
Message ID:
01340515
Vues:
44
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform