Solved

session timing out prematurely?

Posted on 2004-08-04
8
4,275 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.Net Session State alternatives 3 60
Code works but how can I download the file? 20 67
Re-position the objects 7 97
IIS Authorization for Web Service 2 22
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

18 Experts available now in Live!

Get 1:1 Help Now