Solved

session timing out prematurely?

Posted on 2004-08-04
8
4,270 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
Comment Utility
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
Comment Utility
Oops,

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

Expert Comment

by:DotNetLover_Baan
Comment Utility
TimeOut in web.config is what IIS follows. Default is 20. It is definitely overriding what you coded...
0
 

Author Comment

by:dotnet22
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 18

Expert Comment

by:DotNetLover_Baan
Comment Utility
0
 

Author Comment

by:dotnet22
Comment Utility
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
Comment Utility
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
Comment Utility
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

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

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

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

15 Experts available now in Live!

Get 1:1 Help Now