Solved

Session Time Out Problem

Posted on 2014-04-18
9
367 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
"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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Expert Comment

by:Utkarsh Kulkarni
Comment Utility
What is FormAuthentication timeout value ?
0
 

Author Comment

by:regsamp
Comment Utility
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
Comment Utility
ok. also restart the application pool.
0
 

Author Comment

by:regsamp
Comment Utility
Okay, I will do that too
0
 

Author Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

12 Experts available now in Live!

Get 1:1 Help Now