By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

Postback lossing Session values?

P: n/a
Hi Everyone,

I have been fighting a problem for a while and I wonder if someone out
there can help.
This problem has been presented in a number of news postings
previously but I am yet to see a response with a suitable resolution.
So here goes ...

We have a web site which stores an instance of a class into a Session,
which is used in a number of pages. The code looks something like:

Session["CurrentMyClass"] = new MyClass();

This bit of code is executed in (lets say) a login page.

Now in a page later on, I try to do something like:

MyClass localClass = (MyClass)Session["CurrentMyClass"];

and I get the object I put into the session.

My problem is that a large number of customers are experiencing a
problem where they work through the web-site, and at a certain point
the above code line returns null.

* Now this behaviour only seems to occur after they have done a
postback *

Now just to eliminate the first round of expected questions and
answers:

- I am using v1.1 of the framework
- The customers have allowed all cookies including session cookies
within thier browsers
- We do not have a virus scanner or anything else that should be
restarting the application. (As an aside, I have walked through the
web-site with a customer while he was on the phone, and we went
through each of the pages together - me on my browser and him on his -
he hit this problem and I did not).
- The session timeouts are 20 minutes. In the walkthrough mentioned
with the customer earlier, again I didn't hit a problem and we started
a new browser session at the same time.

My frustration is that we cannot reproduce the problem in-house - but
we know customers are hitting this problem as we have embedded tracing
within the pages!

My analysis has lead me to a couple of theories, but my ignorance has
not allowed me to judge them appropriately:

- Could there be a JavaScript configuration issue with client
browsers?
- Could it be a connection speed issue? Most of our customers are on
dial-ups and we are on a fast link to our web-sites.
- Could it be a firewall configuration problem from the client end?
- I am not populating Session["CurrentMyClass"] in Session_Start(). I
am not sure moving this line there will help because in reality I need
to do:

if (something)
Session["CurrentMyClass"] = new MySubClass1();
else
Session["CurrentMyClass"] = new MySubClass2();

where MySubClass1 and MySubClass2 subclass from MyClass, and I only
does this after they have logged in.

- On postback, the Session.IsNewSession is false
- The pages belong to the same web-application
- I don't think I can use an ASPState service or SQL to solve this
problem as MySubClass1 and MySubClass2 are not serializable.
- Myself and a number of my colleagues have walked through the code
independantly to look for logic errors and we are yet to find one (in
this area at least :)

I am guessing this is a client-side configuration issue as this
problem will either always occur for a customer or never occur.

We have moved the web site hosting during this process and this
problem was occuring before and after the move.

Any help would be greatly appriciated. If you need any more info,
please let me know.

Thanks in advance for your consideration of this problem.

Mark Rodrigues
Nov 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
There are additional kb articles on this.

1. http://support.microsoft.com/default...;en-us;Q316148

2. http://support.microsoft.com/default...;en-us;Q323752

3. http://support.microsoft.com/default...;en-us;Q324772

Our problem couldnt be solved by above, as there was antivirus running on
the webserver. Sol Out proc Sql server killed the problem. That i sould say
is the best bet.
"Mark Rodrigues" <ma************@tradergroup.com.au> wrote in message
news:9e**************************@posting.google.c om...
Hi Everyone,

I have been fighting a problem for a while and I wonder if someone out
there can help.
This problem has been presented in a number of news postings
previously but I am yet to see a response with a suitable resolution.
So here goes ...

We have a web site which stores an instance of a class into a Session,
which is used in a number of pages. The code looks something like:

Session["CurrentMyClass"] = new MyClass();

This bit of code is executed in (lets say) a login page.

Now in a page later on, I try to do something like:

MyClass localClass = (MyClass)Session["CurrentMyClass"];

and I get the object I put into the session.

My problem is that a large number of customers are experiencing a
problem where they work through the web-site, and at a certain point
the above code line returns null.

* Now this behaviour only seems to occur after they have done a
postback *

Now just to eliminate the first round of expected questions and
answers:

- I am using v1.1 of the framework
- The customers have allowed all cookies including session cookies
within thier browsers
- We do not have a virus scanner or anything else that should be
restarting the application. (As an aside, I have walked through the
web-site with a customer while he was on the phone, and we went
through each of the pages together - me on my browser and him on his -
he hit this problem and I did not).
- The session timeouts are 20 minutes. In the walkthrough mentioned
with the customer earlier, again I didn't hit a problem and we started
a new browser session at the same time.

My frustration is that we cannot reproduce the problem in-house - but
we know customers are hitting this problem as we have embedded tracing
within the pages!

My analysis has lead me to a couple of theories, but my ignorance has
not allowed me to judge them appropriately:

- Could there be a JavaScript configuration issue with client
browsers?
- Could it be a connection speed issue? Most of our customers are on
dial-ups and we are on a fast link to our web-sites.
- Could it be a firewall configuration problem from the client end?
- I am not populating Session["CurrentMyClass"] in Session_Start(). I
am not sure moving this line there will help because in reality I need
to do:

if (something)
Session["CurrentMyClass"] = new MySubClass1();
else
Session["CurrentMyClass"] = new MySubClass2();

where MySubClass1 and MySubClass2 subclass from MyClass, and I only
does this after they have logged in.

- On postback, the Session.IsNewSession is false
- The pages belong to the same web-application
- I don't think I can use an ASPState service or SQL to solve this
problem as MySubClass1 and MySubClass2 are not serializable.
- Myself and a number of my colleagues have walked through the code
independantly to look for logic errors and we are yet to find one (in
this area at least :)

I am guessing this is a client-side configuration issue as this
problem will either always occur for a customer or never occur.

We have moved the web site hosting during this process and this
problem was occuring before and after the move.

Any help would be greatly appriciated. If you need any more info,
please let me know.

Thanks in advance for your consideration of this problem.

Mark Rodrigues

Nov 17 '05 #2

P: n/a
There are additional kb articles on this.

1. http://support.microsoft.com/default...;en-us;Q316148

2. http://support.microsoft.com/default...;en-us;Q323752

3. http://support.microsoft.com/default...;en-us;Q324772

Our problem couldnt be solved by above, as there was antivirus running on
the webserver. Sol Out proc Sql server killed the problem. That i sould say
is the best bet.
"Mark Rodrigues" <ma************@tradergroup.com.au> wrote in message
news:9e**************************@posting.google.c om...
Hi Everyone,

I have been fighting a problem for a while and I wonder if someone out
there can help.
This problem has been presented in a number of news postings
previously but I am yet to see a response with a suitable resolution.
So here goes ...

We have a web site which stores an instance of a class into a Session,
which is used in a number of pages. The code looks something like:

Session["CurrentMyClass"] = new MyClass();

This bit of code is executed in (lets say) a login page.

Now in a page later on, I try to do something like:

MyClass localClass = (MyClass)Session["CurrentMyClass"];

and I get the object I put into the session.

My problem is that a large number of customers are experiencing a
problem where they work through the web-site, and at a certain point
the above code line returns null.

* Now this behaviour only seems to occur after they have done a
postback *

Now just to eliminate the first round of expected questions and
answers:

- I am using v1.1 of the framework
- The customers have allowed all cookies including session cookies
within thier browsers
- We do not have a virus scanner or anything else that should be
restarting the application. (As an aside, I have walked through the
web-site with a customer while he was on the phone, and we went
through each of the pages together - me on my browser and him on his -
he hit this problem and I did not).
- The session timeouts are 20 minutes. In the walkthrough mentioned
with the customer earlier, again I didn't hit a problem and we started
a new browser session at the same time.

My frustration is that we cannot reproduce the problem in-house - but
we know customers are hitting this problem as we have embedded tracing
within the pages!

My analysis has lead me to a couple of theories, but my ignorance has
not allowed me to judge them appropriately:

- Could there be a JavaScript configuration issue with client
browsers?
- Could it be a connection speed issue? Most of our customers are on
dial-ups and we are on a fast link to our web-sites.
- Could it be a firewall configuration problem from the client end?
- I am not populating Session["CurrentMyClass"] in Session_Start(). I
am not sure moving this line there will help because in reality I need
to do:

if (something)
Session["CurrentMyClass"] = new MySubClass1();
else
Session["CurrentMyClass"] = new MySubClass2();

where MySubClass1 and MySubClass2 subclass from MyClass, and I only
does this after they have logged in.

- On postback, the Session.IsNewSession is false
- The pages belong to the same web-application
- I don't think I can use an ASPState service or SQL to solve this
problem as MySubClass1 and MySubClass2 are not serializable.
- Myself and a number of my colleagues have walked through the code
independantly to look for logic errors and we are yet to find one (in
this area at least :)

I am guessing this is a client-side configuration issue as this
problem will either always occur for a customer or never occur.

We have moved the web site hosting during this process and this
problem was occuring before and after the move.

Any help would be greatly appriciated. If you need any more info,
please let me know.

Thanks in advance for your consideration of this problem.

Mark Rodrigues

Nov 17 '05 #3

P: n/a
Thanks a lot Rajesh for responding (and looking up the MS KB).

Unfortunately, non of these problems describe scenarios I am
encountering.

If someone said there was a problem with the framework and I had to
work-around this problem by using an out of proc server solution then
I would be happy to do so.

I don't like the idea of doing so if I am theoretically doing
everything right and there isn't a problem with the framework. Making
a change may just be hiding an underlying problem in my code that I
haven't found yet and moving to an out of proc server just hides it
.... for a little while ...

If the problem is a client-side one, then I don't suspect moving to an
out of proc model will help me anyway.

Does anyone else out there have any ideas or experiences with a
similar scenario?

Thanks again.

Mark
Nov 17 '05 #4

P: n/a
Thanks a lot Rajesh for responding (and looking up the MS KB).

Unfortunately, non of these problems describe scenarios I am
encountering.

If someone said there was a problem with the framework and I had to
work-around this problem by using an out of proc server solution then
I would be happy to do so.

I don't like the idea of doing so if I am theoretically doing
everything right and there isn't a problem with the framework. Making
a change may just be hiding an underlying problem in my code that I
haven't found yet and moving to an out of proc server just hides it
.... for a little while ...

If the problem is a client-side one, then I don't suspect moving to an
out of proc model will help me anyway.

Does anyone else out there have any ideas or experiences with a
similar scenario?

Thanks again.

Mark
Nov 17 '05 #5

P: n/a
Mark,

I have been experiencing the same (dare I say it...) bug in ASP.NET
(.NET 2003). In my case, I have code in the page load event of every
page that checks for the existence of certain session variables;
specifically, userid values that I want persisted, but hidden from
prying eyes.

And sometimes they just go away!

I have had this happen on our remote site and had it happen on our
localhost, but it is very sporadic and I know of no way to reproduce
it.

I am extremely frustrated with this issue, especially knowing that I
look stupid in the eyes of my boss and our clients. And without being
able to reproduce it at will, Microsoft will probably ignore it and
just let our web apps continue to fail.

Sigh....
Paul Drust
pa***@maronsoftware.com
Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.