Solved

session timing out prematurely?

Posted on 2004-08-04
8
4,279 Views
Last Modified: 2008-01-09
I'm sending a link in an email that has a session id embedded in it to allow a download for a set period of time. Now the link seems to work fine for the first five minutes but after that I get the following error
"Object reference not set to an instance of an object"

Programtically I'm setting the Session to a full day as follows
Session.Timeout = 1440;

but the web.config file is as follows:
<sessionState
            mode="InProc"
            .......
            .......
            cookieless="true"
            timeout="20"
    />

So the questions are does the web.config's timeout override the programmatic timeout of 1440. If so, the link is going bad after 5 minutes not 20? What could be the problem?
0
Comment
Question by:dotnet22
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Expert Comment

by:Clif
ID: 11716371
You need to set the app script timeout for the particular virtual directory you're using.

In the Properties pages for any Web site or Web virtual directory

Click the Home Directory or Virtual Directory tab.
Under Application Settings, click Configuration. An application must be created for the button to be active.
Click the Options tab.
Type the length of time (in seconds) for an ASP script to time out in the ASP Script timeout box.
0
 
LVL 10

Expert Comment

by:Clif
ID: 11716397
Oops,

Not app script timeout.  It's asp script timeout.
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11716456
TimeOut in web.config is what IIS follows. Default is 20. It is definitely overriding what you coded...
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

Author Comment

by:dotnet22
ID: 11716508
DotNetLover,

If this is the case, it still times out before the 20 minutes. So what I'm wondering is what event is raised when all session variables are disposed of? What event would this be in the Global.asax file. I could send out an email to myself when this event is raised but how would I know what caused this restart? Basically the source of the restart?
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11716710
0
 

Author Comment

by:dotnet22
ID: 11717792
I think I found the cause of the premature case: I was uploading a new application which causes everything to be reset. Duh. But then another question is if
Sesstion.Timeout is overridden by the timeout value in the web.config file, then what is the point of the Session.Timeout value? If I set the web.config file timeout to 30 minutes and set the Session.Timeout=10 minutes, then which one will be the valid one? The 10 minutes or 30 minutes?
0
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 500 total points
ID: 11717967
well.. you got it wrong... what I meant is... It shouldn't override the value you specify in the code. But in your case it was doing so. If the application is restarted IIS will go by the TimeOut value in the web.config.

>>If I set the web.config file timeout to 30 minutes and set the Session.Timeout=10 minutes, then which one will be the valid one? The 10 minutes or 30 minutes?<<

the answer is 10 mins... as long as there is no change/restart in the application.
0
 

Author Comment

by:dotnet22
ID: 11718089
I thought it was because I was uploading a new application. but this doesn't seem to be the case because I haven't done so but the link has gone bad anyway. Is there something in the Global.asax events that is triggered when all sessions or restarts are triggered. I could basically email myself a message and possibly try to find the source of the restart?
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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