Link to home
Create AccountLog in
Avatar of amillyard
amillyardFlag for United Kingdom of Great Britain and Northern Ireland

asked on

asp.net logged in user session -- cannot get to last longer than 20 minutes

cannot seem to get the user logged in session to last longer than 20 minutes -- i.e. return to page, click on something and then get redirected back to Login.aspx page.

I have added the attached sessionState timeout -- hoping this would help.

Would else do I need to do please?
<sessionState timeout="60"> </sessionState>

Open in new window

Avatar of ZachSmith
ZachSmith
Flag of United States of America image

Set the session timeout in IIS as well:

Look at the bottom of this page:
http://www.netline.ch/support/info/aspcomp/safileup/install_tailor_sessiontimeout.htm
Avatar of amillyard

ASKER

ZachSmith:  I have already set the IIS 6 session timeout to 60 minutes
Have you verified that you aren't setting the session timeout any where else? Such as global.asax?
ZachSmith: not that I am aware off -- the global.asax is very generic (as start of project creation) -- only a few session variable created and a user count  script.
Do you have multiple web.config files within the site?
Do you have multiple servers? Are you sure the website is not recompiling due to code changes? That will also cause session expiration.
ZachSmith:  checked all folders and sub-folders -- no additional web.config files
ZachSmith:  the development enviroment is as follows:

intial code production -- local, virtual asp server (via visual studio 2008 pro)

once basic debug done -- published to remote server (staging - web site)
more remote testing -- then publish to remote site (live - web site)

at this stage, both the staging and live web-site are hosting on the same window 2003 server, iis 6
both have unique ip's, and ssl secured

that the environment -- mutilple servers remote -- no, just multiple sites within the same server environment
Which environment is having the session issue? Or is it all of them?
all of them I think... my colleagues have over the past weeks indicated this issue, of course they are using both systems (web apps) at various times.
so much so, they on many occassions they don't even get to the 20 minutes
The only other thing I can think of is to set the session timeout in IIS on the Default Website.. I have read that that could make a difference.

Other than that, it could be possible that the data is being cached on the client, which means the server wouldn't be hit.. If you put this at the top of your .aspx pages it will disable client-side caching:

<%@ OutputCache Location="None" VaryByParam="None" %>
ZachSmith:  like so?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="testApp.WebForm1" %>

<%@ OutputCache Location="None" VaryByParam="None" %>

More like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="testApp.WebForm1" OutputCache Location="None" VaryByParam="None" %>
when I do that I am getting the following error:

Validation (ASP.Net): Attribute 'OutputCache' is not a valid attribute of element 'Page'.
ASKER CERTIFIED SOLUTION
Avatar of ZachSmith
ZachSmith
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ZachSmith:  many thanks  :-))
ZachSmith: some feedback -- the:  <%@ OutputCache Location="None" VaryByParam="None" %>   was the missing link in getting this to work.

have checked on a couple of pc's and is working fine now.

again, many thanks :-))