Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sessions "Timing Out"

Status
Not open for further replies.

AppzDev

MIS
Oct 9, 2002
57
US
I have created a basic asp application in which a user logs in to the app and has the ability to enter/edit/retrieve data for persons that are selected in a listbox.

One of the requirements is that an office manager from office A not see the listing of people in the listbox as those in Office B. So, what i did was to create a office_id field in tblUserNames in my SQL database. I am grabbing Username and Office_ID and putting them into sessions from the login. So, Session("Username") and Session("Office_ID"). I know these sessions are being passed from page to page b/c i've set labels up in a test system to *SHOW* me that they are being passed.

Here is my dilemma. I filter the listboxes based on a query using the office_id session i am using throughout the pages. Well, seemingly this session "gets lost" after some time. I know the default time is 20 minutes but the user is browsing pages etc. Now, i've set NO sessionStates etc in my web.config nor have i tried to alter the timeout on the IIS side of things.

If anyone has run into this before or perhaps knows of a better way to capture the information i need when the user logs into the system i would greatly appreciate it.

Thanks in advance

dc~
 
<snip>&quot;gets lost&quot; after some time. I know the default time is 20 minutes </snip>

How long before it goes away?
 
That's the thing. It doesn't seem like there is any set amount of time that it actually produces the error. Prior me putting in some error handling, when i redirected to the chooseemp.aspx page i would get a syntax error near the '='

I looked and that is where i have select blah blah from blah blah where emp_id = blah blah and office_id = mySession. <--- mySession = Session(&quot;office_id&quot;) So what the error is telling me is that the session is no longer being held.

Because it doesn't seem to happen at no particular time etc, i am inclined to think it has something to do with my code. I am grabbing the sessions on page_load. One thought i have is to grab them AFTER if not ispostback etc instead of before. Deep Breathe.....

Is there an easier/better/more efficient way of doing what i want to do?? I am fairly new to asp.net but have an extensive database background.

Thanks again,

dc~
 
Has your webserver restarted? That will kill a session variable as it is held in the memory space of iis.

You might want to look at a session state server to avoid problems of restarts.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top