Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 19th, 2007, 03:07 PM
Registered User
Join Date: Jan 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Regarding this feature where .NET watches a directory for changes and restarts, is there some way of disabling it? I have a folder that contains changing items and I want to exclude this folder from forcing the site to reload. I have tried moving the folder around but since it contains DLLs used by the site it seems that it gets watched regardless of where I put it. There must be SOME way of configuring the service to ignore a folder
Old January 22nd, 2007, 03:43 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

This has all been very interesting and illuminating. I now have a clearer understanding of features of IIS.

But my problem appears to be an animal of a different stripe. When one of my users loses his credentials being held in the Session, all users lose their credentials and are presented the login page instead of the requested page.

Now, each person’s Session is actually an element in an object that holds all the “Sessions.” (A Dictionary object I believe.) Since all Sessions evaporate at the same time, I am presuming this central object is being reset, or abandoned and recreated.

If anyone has any insight on what mechanism might be at play here, I’d be really happy to hear it.
Old January 22nd, 2007, 04:31 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi Brian,

Isn't this what most of the posters had problems with? When the IIS process is recycled, or web.config is touched, the *whole* session state goes down.

Did any of the situations apply to you? That is, do you have application pools set to recycle automatically at a certain interval for example?

Take a look here: http://blogs.msdn.com/david.wang/arc...e_on_IIS6.aspx for some more background.

Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Old October 17th, 2008, 10:38 PM
Registered User
Join Date: Oct 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Got the same problem: Session vars disappear!

Using trace="on", could see session vars on page load but on post back all session vars gone! Didn't show up until switched from asp.net 1.x to 2.0

Took awhile but I did find the cause. Not in the vb source code...it's in one of the asp:image... tags! Two ways to fix or work-around:

1) Remove or comment out asp:image tag
   (just ones with missing imageURL should do)
2) Add imageURL="valid link" to asp:image tags (if missing)

To test, deleted almost all code in the code behind. Except for setting about 5 session vars on page load and one in post back.
I didn't try imageURL with an invalid link to see if that blows-up all the session vars too, geez, I hope not.

In original asp.net 1.x version the imageURL fragment was set in code. At design time, the imageURL was left blank. This didn't affect the session vars as it seems to do now under asp.net 2.0

If I may politically digress, hasn't someone read you the book 'The Earth is Flat'...Session Vars CAN'T DISAPPEAR...you're wrong!!!!

I've noticed this is one of several problems that seem to have no solution...;)

Old October 20th, 2008, 04:38 PM
Registered User
Join Date: Oct 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

On further review, there seems to be more than one issue that can cause disappearing session vars.

Older documents document, undocumented behavior of ReadOnly session vars: "If you attempt to write to a read-only session variable, no exception is thrown but a new session ID is generated...can create subtle bugs in your code...check the IsReadOnly property before assigning..."

<%@ Page EnableSessionState="ReadOnly %>

On hosted servers with garderns, farms and proprietary performance enhancers it may not be impossible to track session var behavior but software source generation performance can be severely reduced
Old June 8th, 2010, 10:45 AM
Registered User
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Friends, please check how many working process has IIS configured. Make sure it is set to 1. I realised that if you has this value set to 2 or more, session variables get lost for some reason. I think you need more than one processor in your server if you plan raising the amound of working processes.
Old July 26th, 2012, 02:16 PM
Registered User
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Originally Posted by Mr_Tom View Post
I had to reply here... I think I have found a solution to the random loss of Session Variables issue on IIS6.

Here is what we experienced:
- Session variables seemed to just disappear for no apparent reason
- not reproducible on demand - erratic, sometimes happens every couple of seconds. sometimes it's fine for minutes.
- We have seen the session variables disappear for one page in the site and then re-appear for a different page (or even the same page) later on, not actually having lost the variable for good.
- we actually run those sites load-balanced and it only happened on one of the servers in the webfarm.

[u]Our Solution</u>
For some strange reason we had a non-default setting in the Application Pools Properties. The webgarden was configured to use a maximum of 2 worker processes. With this setting we had the server randomly using process 1 or 2... causing this erratic behavior.
[u]To fix this:</u>
- open the IIS management console
- get properties on: "Application Pools"
- tab to: "Performance"
- find the setting under "Web garden" and decrease the "Maximum Number of Worker Processes" to "1"
- do an IISReset and test your application

This worked for us and saved me a lot of time, as I was just about to re-build the server (I had all my hair pulled out already :(

Good luck to all!

Thank you soooooooooooooooooo much! I was on the verge of tears here. Been fighting with the server for days, with a ton of users cursing up to my great-great-grandmother, by e-mail, with copy to the boss (nice co-workers I got, huh?!). And I was about to make a new server, but there is no need now.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Variables Randomly Disappeared Dmitriy .NET Framework 1.x 1 November 30th, 2006 01:24 AM
Session Variables in C# shikha09 C# 1 November 28th, 2006 10:38 AM
Session Variables Randomly Disappeared Dmitriy General .NET 0 November 20th, 2006 08:42 AM
Is it possible for me using session variables into see07 ASP.NET 1.x and 2.0 Application Design 4 March 9th, 2005 07:46 PM
session variables help face Classic ASP Databases 4 September 12th, 2003 03:57 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.