views:

1092

answers:

9

Hi, I have a web page where the user select a Company and with that I keep the Company name in memory though a Session but when I go to the next page the Session only last like 5 minutes? Any reason why and how I can fix this, I did extend the Session state in the Web.config but that did not work.

Example: Session("CompanyName") = "Bytes Technology"

In my web.config I have: timeout="40" />

I move from Default.aspx to CompanyDetail.aspx with my Session("CompanyName")

But if I let the program idle in CompanyDetail.aspx I lose the Session State.

Any ideas?

Regards Etienne

+4  A: 

some questions:

  • the timeout time is always the same? 5 minutes?
  • is your site running in a load-balancing server farm? with more than one front-end server?
  • what are you telling in your web.confing regarding sessions and sessionstate?
ila
Yes, if i let the page idle any longer than 5min i lose my Session.Yes, i think my site is running in a load-balancing server farm.....i am not doing the hosting, another company is doing it for me.This is what i am telling my web.config.<sessionState timeout="30" />
Etienne
+1  A: 

In IIS, go into the properties of your website, click to the Home Directory tab and then click the Configuration button. Here, click the options tab and check the Session timeout there. I'm pretty sure this only effects classic ASP, but I'm not 100% sure.

Tristan Havelick
+1  A: 

If this happens always at 5 minutes then check web.config for session settings, and check IIS: website/Properties/ASP.NET, click on Edit Configuration, select State Management tab, and check session settings.

Biri
A: 

could there be some antivirus on the server that's causing the web app to reset itself every 5 minutes, with the ASP.NET runtime thinking either the binaries or the web.config has changed? that is also possible.

cruizer
+5  A: 

from your comment I see that you think your site is in a load-balancing server farm.

in this case you need to store your session in db or avoid using it: you cannot be sure that the same server will serve the same user each time he does a postback, and if the user goes from server "A" to server "B" in two different posts... your session variables are lost.

try a google search for "sessionstate database", you'll find tons of stuff on this.

hope this helps

andrea

ila
Thanks for the reply, i will find out from the company who is hosting my site and tell them to check all of that. I cant not use Sessions because i used it everywhere on my website. Go check it out www.erate.co.za . Regards Etienne
Etienne
well if you have a sql server database that you can access, you could think to create the necessary database stuff for yourself - if the provider does not help. bye!
ila
A: 

Another idea is to put the machine name into a comment on a page and see if that is changing from page to page just to confirm that there is a changing of the server handling the request.

JB King
+3  A: 

I'd wager your not using a load-balanced farm, and are actually using shared hosting.

In a load balanced farm, your code is deployed to multiple servers, and if you have sticky sessions disabled, the user will utilize the server with the least load on each request.

Since you are using 3rd party hosting, I heavily doubt you are doing that.

Session timeout can be hardset in IIS by the host provider, and the most likely culprit is that they have set this to 5 minutes.

Call your host provider, ask them what their IIS session settings are, and go from there.

FlySwat
Hi, thank you for the reply. I am busy talking to my host provider and awaiting a response. I will you all know what happened. Thanks Etienne
Etienne
A: 

Hi, thank you everyone for all the information. The company hosting my site just extended the time of the application pool and that worked!

Thanks Etienne http://www.erate.co.za

Etienne
A: 

I decided to scrap using Session Variables and went with Query Strings!! Much better!!

Etienne