Solved

Session Time Out Problem

Posted on 2014-04-18
9
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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
 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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