Home All Groups Group Topic Archive Search About

Accessing timeout property of formsauthentication

Author
10 Aug 2006 3:40 PM
Eric
If one wants to do their own FormsAuthentication cookie/ticket instead
of using built in features, how do we access the timeout property?

That is, in:
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
        "userName",
        DateTime.Now,
        DateTime.Now.AddMinutes(XXXX), // value of time out property
        false, // Value of IsPersistent property
        String.Empty,
        FormsAuthentication.FormsCookiePath);

How can I access in:
<authentication mode="Forms">
  <forms name="App1" loginUrl="~/AccessDenied.aspx" protection="None"
timeout="60"/>
</authentication>

the timeout=60 property and set XXXX to 60 minutes?

Yes, I could parse the web.config file, but I'm looking for a more
elegant solution.  Ideas anyone?

Thanks,
Eric

AddThis Social Bookmark Button