Question

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

Was it helpful?

Solution 8

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

OTHER TIPS

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

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?

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.

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.

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.

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.

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top