ASP.NET 2.0 BasicsIf you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I'm trying to use session variables throughout a new dynamic site that I've created, but I'm running into problems with the session var's timing out even though there is activity by the user.
These are the basic steps that are involved with the sessions:
1) The user logs in with a username & password that must match a DB record (level1.aspx). This form's submittal redirects the user's browser to a background script page (bgscript.aspx).
2) If user is valid, SessionID is set for user on the background script page, like this:
Dim strSessionID As String = Session.SessionID
Session("SessionID") = strSessionID
Then the user is then redirected to the dynamic main page for the site (level2.aspx).
3) On level2.aspx, the Session.Timeout is set for 40 minutes. All pages are accessed dynamically from this page through SSI's. If the user's SessionID is empty, then they're redirected like this:
If Session("SessionID") = "" Then
Response.Redirect("logoff.aspx?timeout=true")
End If
The problem is that while the user browses the pages dynamically through the level2.aspx main page, the sessions all timeout after 20 minutes even though the user is active.
Could this be happening because I'm setting the SessionID on the bgscript.aspx page vs. the level2.aspx page? (Note: I'm doing that because the SessionID is inserted into a DB table on this same bgscript.aspx page) Shouldn't session variables pass between any pages on a site as long as the browser window is open? I'd really appreciate any help. Thanks.