views:

161

answers:

1

I am using ASP.NET Forms Authentication and currently setting the timeout value in Web.config. Is there a way to set this timeout from code instead? I would like to have different timeouts for different users.

+3  A: 

Check out the FormsAuthenticationTicket on MSDN

FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
        "userName",
        DateTime.Now,
        your_time_out_goes_here, // value of time out property
        false, // Value of IsPersistent property
        String.Empty,
        FormsAuthentication.FormsCookiePath);
Pierre-Alain Vigeant