We help IT Professionals succeed at work.
Get Started

Forms authentication ticket seems to expire pre-maturely and kick out the user

1,611 Views
Last Modified: 2012-09-05
Although I set the timeout to 60 or 1440, it seems the user gets logged out in few minutes, may be 20-30 mts.

Any suggestions would be great.HOw canI start debugging this issue?

    <sessionState mode="InProc" stateConnectionString="tcpip=something" sqlConnectionString="data source=something;Trusted_Connection=yes" cookieless="false" timeout="60" />
      <forms name=".DSA" loginUrl="frmStartLogin.aspx" defaultUrl="/frmStart.aspx" protection="All" timeout="1440" path="/" slidingExpiration="true" />
 Dim tkt As FormsAuthenticationTicket
            Dim cookiestr As String
            Dim ck As HttpCookie
            Dim intTimeoutMinutes As Integer = 1
            Dim intRtn As Integer = 1

            Try
                'set cookie timout period based on isPersistent
                If isPersistent Then
                    intTimeoutMinutes = 43200 '30 days
                Else
                    intTimeoutMinutes = 60
                End If
                'create auth cookie
                tkt = New FormsAuthenticationTicket(1, strUserName, DateTime.Now(), DateTime.Now.AddMinutes(intTimeoutMinutes), isPersistent, strUserName)
                cookiestr = FormsAuthentication.Encrypt(tkt)
                ck = New HttpCookie(FormsAuthentication.FormsCookieName(), cookiestr)
                If isPersistent Then
                    ck.Expires = tkt.Expiration
                End If
                ck.Path = FormsAuthentication.FormsCookiePath()
                'write auth cookie to client PC
                System.Web.HttpContext.Current.Response.Cookies.Add(ck)
               
            Catch ex As Exception
                intRtn = -1
            End Try
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE