Question

I had implemented custom asp.net authentication and added all the required attributes even then the user are signout frequently.

I had hosted this website on shared godaddy server.

Here is my code:

var ticket = new FormsAuthenticationTicket(2, auth.Message.ToString(), DateTime.Now, DateTime.Now.AddDays(3), true,
                                           string.Empty, FormsAuthentication.FormsCookiePath);
        var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket))
        {
            Domain = FormsAuthentication.CookieDomain,
            Expires = DateTime.Now.AddYears(50),
            HttpOnly = true,
            Secure = FormsAuthentication.RequireSSL,
            Path = FormsAuthentication.FormsCookiePath
        };
        Response.Cookies.Add(cookie);
        Response.Redirect(FormsAuthentication.GetRedirectUrl(auth.Message.ToString(), true));

My Web.config has these values:

<authentication mode="Forms">
  <forms requireSSL="false" timeout="120" loginUrl="~/CRM/Logon.aspx" defaultUrl="~/CRM/OTP.aspx" />
</authentication>

My users are complaining that they are logged off around 10-20 minutes

Any help is appreciated.

EDIT

I had removed requireSSL="false" timeout="120" and even then no effect.

I am not using session as well

Was it helpful?

Solution

The problem is we need to specify Application Pool Idle timeout also to make the above conditions works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top