Solved

Session Time Out Problem

Posted on 2014-04-18
9
371 Views
Last Modified: 2014-04-24
We are using Cookies Mode for Session State (IIS 7) and we have the time-out session set to 200 minutes but it is still timing out on our Intranet every 20 minutes or so. Below is the coding for the cookie.

Any help resolving this would be greatly appreciated.

Dim RememberCookie As New HttpCookie("DWMARemember")
        Dim UsernameCookie As New HttpCookie("DWMAUserName")
        Dim PasswordCookie As New HttpCookie("DWMAPassword")
        Dim AccessLevelCookie As New HttpCookie("DWMAAccess")
        Dim dt As DateTime = DateTime.Now
        Dim ts As New TimeSpan(30, 0, 0, 0)

        Dim Usuario As New DWMAUser()

        Usuario.UserName = txtUserName.Text
        Usuario.Password = txtPassword.Text

        If Usuario.Authenticate Then
            If chkRememberMe.Checked Then
                RememberCookie.Value = "y"
                RememberCookie.Expires = Date.Today.AddMonths(1)
                UsernameCookie.Value = Usuario.UserName
                UsernameCookie.Expires = Date.Today.AddMonths(1)
                PasswordCookie.Value = Usuario.Password
                PasswordCookie.Expires = Date.Today.AddMonths(1)
                AccessLevelCookie.Value = Usuario.UserLevel
                AccessLevelCookie.Expires = Date.Today.AddMonths(1)
                Response.Cookies.Add(RememberCookie)
                Response.Cookies.Add(UsernameCookie)
                Response.Cookies.Add(PasswordCookie)
                Response.Cookies.Add(AccessLevelCookie)
            End If
            Session("sDWMAFirstName") = Usuario.FirstName
            Session("sDWMALastName") = Usuario.LastName
            Session("sDWMANickName") = Usuario.NickName
            Session("sDWMAUserLevel") = Usuario.UserLevel

            FormsAuthentication.RedirectFromLoginPage(Usuario.UserName, chkRememberMe.Checked)
        Else
            lblError.Text = "Wrong user id or password. Please try again."
        End If
    End Sub
End Class
0
Comment
Question by:regsamp
  • 5
  • 3
9 Comments
 
LVL 12

Assisted Solution

by:jitendra patil
jitendra patil earned 250 total points
ID: 40010040
as by its nature session will expire after 20 minutes.
please refer the below link to configure the setting in IIS
Configure Use Cookies Mode for Session State (IIS 7)
Session timeout problem in IIS7
hope this helps.
0
 

Author Comment

by:regsamp
ID: 40010703
I have changed the Session State time and it does not matter what I change it to, it will still always time out after 20 minutes.
0
 
LVL 7

Expert Comment

by:Utkarsh Kulkarni
ID: 40014296
Are you using FormsAuthentication ?
If yes, check the time value for FormsAuthentication Ticket in config.

Also, there are 3 ways where you can set session timeout
1. In IIS
2. In Web.config
& 3. Global.asax

Set this value at all three places and then check.
0
 

Author Comment

by:regsamp
ID: 40014658
"Also, there are 3 ways where you can set session timeout
1. In IIS
2. In Web.config
& 3. Global.asax

Set this value at all three places and then check."

We have set the value to 300 minutes in all of these locations and after 20 minutes of inactivity, the user will always have to log back on.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 7

Expert Comment

by:Utkarsh Kulkarni
ID: 40014718
What is FormAuthentication timeout value ?
0
 

Author Comment

by:regsamp
ID: 40015453
It is 300. We might have found the issue. We restarted IIS after the setting changes but it looks like the process was still running. We had to kill the process and the setting changes might have stuck now. We are monitoring.
0
 
LVL 7

Accepted Solution

by:
Utkarsh Kulkarni earned 250 total points
ID: 40015589
ok. also restart the application pool.
0
 

Author Comment

by:regsamp
ID: 40015636
Okay, I will do that too
0
 

Author Comment

by:regsamp
ID: 40020550
Restarting all the services seemed to be the issue. Thank you for the help.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now