Solved

Session Time Out Problem

Posted on 2014-04-18
9
375 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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