Showing posts with label dissappears. Show all posts
Showing posts with label dissappears. Show all posts

Monday, March 26, 2012

Session variable becomes null

Hi All,

I have a very weird issue with my session variable and I'm hoping that
someone can help me out. The issue is my session variable dissappears after
a request is redirected to a new page. What I have in this new page is
streamwriter which writes user's data to a log file. Now if I comment out
the line that calls the write method of the streamwriter, the session
variable is fine.

Thanks in advance for any helps

Sam"Sam" <askhuy@.yahoo.comwrote in message
news:On8wkwVRHHA.1212@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

I have a very weird issue with my session variable and I'm hoping that
someone can help me out.


A little difficult unless you actually post your code...
Mark Rae wrote:

Quote:

Originally Posted by

"Sam" <askhuy@.yahoo.comwrote in message
news:On8wkwVRHHA.1212@.TK2MSFTNGP03.phx.gbl...
>

Quote:

Originally Posted by

>I have a very weird issue with my session variable and I'm hoping that
>someone can help me out.


>
A little difficult unless you actually post your code...


Didn't take your psychic pill this morning, did you Mark?

:-)

--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
"Laurent Bugnion [MVP]" <galasoft-lb@.bluewin.chwrote in message
news:utzyUrWRHHA.4896@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Quote:

Originally Posted by

>A little difficult unless you actually post your code...


>
Didn't take your psychic pill this morning, did you Mark?


No but, spookily, somehow I knew you were going to say that... ;-)
Most common reasons why Session would disappear

1. Application was restarted. Happens when .NET abandons application for
whatever reason. Like leak of memory or application become irresponsive
after some time, ....

2. Config file was changed.

3. aspx files were changed (there is a limit of 15 changes aspx files, after
that application restarts).
3.1 New folder was created

4. Antivirus kicks in and starts "touching" files. Thus #4 goes to #3

5. The Session was establish under another domain name. Meaning you had
login page on www.mysite.com and the redirect user to mysite.com (no www) ->
Session is lost. Same for IP address. You established seesion on 10.10.10.10
and redirect to www.mysite.com - Session is lost even if www.mystite.com
resolves to 10.10.10.10

Not sure what is your reason but most likely #3 or #5

George.

"Sam" <askhuy@.yahoo.comwrote in message
news:On8wkwVRHHA.1212@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hi All,
>
I have a very weird issue with my session variable and I'm hoping that
someone can help me out. The issue is my session variable dissappears
after a request is redirected to a new page. What I have in this new page
is streamwriter which writes user's data to a log file. Now if I comment
out the line that calls the write method of the streamwriter, the session
variable is fine.
>
Thanks in advance for any helps
>
Sam
>


I am running into a similar problem in that my application at times, has a
new Session after a redirection, in the same virtual directory. I am not
calling Session.Abandon() or anything like that. The Session with stored
data simply disappears. It is a major problem.

HELP!!!

Thanks,
Eagle

"George Ter-Saakov" wrote:

Quote:

Originally Posted by

Most common reasons why Session would disappear
>
1. Application was restarted. Happens when .NET abandons application for
whatever reason. Like leak of memory or application become irresponsive
after some time, ....
>
2. Config file was changed.
>
3. aspx files were changed (there is a limit of 15 changes aspx files, after
that application restarts).
3.1 New folder was created
>
4. Antivirus kicks in and starts "touching" files. Thus #4 goes to #3
>
5. The Session was establish under another domain name. Meaning you had
login page on www.mysite.com and the redirect user to mysite.com (no www) ->
Session is lost. Same for IP address. You established seesion on 10.10.10.10
and redirect to www.mysite.com - Session is lost even if www.mystite.com
resolves to 10.10.10.10
>
>
Not sure what is your reason but most likely #3 or #5
>
>
George.
>
>
"Sam" <askhuy@.yahoo.comwrote in message
news:On8wkwVRHHA.1212@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hi All,

I have a very weird issue with my session variable and I'm hoping that
someone can help me out. The issue is my session variable dissappears
after a request is redirected to a new page. What I have in this new page
is streamwriter which writes user's data to a log file. Now if I comment
out the line that calls the write method of the streamwriter, the session
variable is fine.

Thanks in advance for any helps

Sam


>
>
>

Session Variable dissappears between post backs on Win 2003

I have a problem with a Session variable that dissapears after a
postback of one of my pages.
This only happens on WIn 2003 servers.. it is fine on my XP dev box.
This page opens in another window, but I have ascertained that is is
definitely using the same session ID.
Nowhere on the page do I clear the session variable.. it is only ever
retrieved... this page only works if it is there.
Has anyone had as similar problem? Any help gratefully received!
Dirc
--Is the Windows 2003 server (you say servers which leads me to ask this) part
of a webfarm? You may be losing sessions as you are moved from one server to
another. If this is a the case one way to fix this would be to store session
state on the SQL Server, if you're using one.
Here's an article on how to move session state to the SQL Server. It's easy
to do and has some other benefits such as users not losing their sessions
even if a server in the farm needs to be restarted, etc.
http://idunno.org/dotNet/sessionState.aspx
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Dirc Khan-Evans" <dirc.khan-evans@.eurorscgskybridge.com> wrote in message
news:uTgSjp$0FHA.3376@.TK2MSFTNGP14.phx.gbl...
> I have a problem with a Session variable that dissapears after a
> postback of one of my pages.
> This only happens on WIn 2003 servers.. it is fine on my XP dev box.
> This page opens in another window, but I have ascertained that is is
> definitely using the same session ID.
> Nowhere on the page do I clear the session variable.. it is only ever
> retrieved... this page only works if it is there.
> Has anyone had as similar problem? Any help gratefully received!
> Dirc
> --
>
No, no, no..
I mean in multiple environments.. dev, testing and live.
BTW, I have also tried using StateServer, since I have been told it is
more reliable.. but something as simple as this should not happen on a
lightly used test server!
Dirc,
Ok, I didn't realize you meant between multiple environments. So, you've
already stated that this is not hapenning on your development box. Is it
happening on the testing and production servers both? Are other developers
deploying code to the testing or production servers at the same time?
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Dirc Khan-Evans" <dirc.khan-evans@.eurorscgskybridge.com> wrote in message
news:%23SNpu5$0FHA.3924@.TK2MSFTNGP14.phx.gbl...
> No, no, no..
> I mean in multiple environments.. dev, testing and live.
> BTW, I have also tried using StateServer, since I have been told it is
> more reliable.. but something as simple as this should not happen on a
> lightly used test server!
> --
>
S. Justin Gengo wrote:

> Dirc,
> Ok, I didn't realize you meant between multiple environments. So,
> you've already stated that this is not hapenning on your development
> box. Is it happening on the testing and production servers both? Are
> other developers deploying code to the testing or production servers
> at the same time?
No.. I am the only one changing anything in the bin folder... I know
where you are coming from.. There are no changes going on that would
cause an IIS restart.
To reiterate: The interesting things to note is that
(a) it always happens with this page.. it is in no way an intermittent
problem,
(b) this only happens when the new page is displayed in another window.
The first page loads fine but after that the session variable totally
dissappears for no apparent reason.. there is no explicit removal of
any Session variables in the code.
(c) It only happens on IIS6/ win 20003 servers. Not XP
(d) The session has the same sessionID for both windows (as expected).
This really smells of a bug to me....
Dirc
Dirc,
Ok, here's a test to try. In the first window create a button that, when
clicked, response.writes the session variable to the page.
Open the page and click the button to confirm the session variable is there.
Then open your second page. Click the first page's session variable button
again to see if the session variable has disappeared. I'm wondering if the
pop-up window is somehow using a different session.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Dirc Khan-Evans" <dirc.khan-evans@.[no_spam_please]eurorscgskybridge.com>
wrote in message news:ODVldSI1FHA.1252@.TK2MSFTNGP09.phx.gbl...
> S. Justin Gengo wrote:
>
> No.. I am the only one changing anything in the bin folder... I know
> where you are coming from.. There are no changes going on that would
> cause an IIS restart.
> To reiterate: The interesting things to note is that
> (a) it always happens with this page.. it is in no way an intermittent
> problem,
> (b) this only happens when the new page is displayed in another window.
> The first page loads fine but after that the session variable totally
> dissappears for no apparent reason.. there is no explicit removal of
> any Session variables in the code.
> (c) It only happens on IIS6/ win 20003 servers. Not XP
> (d) The session has the same sessionID for both windows (as expected).
> This really smells of a bug to me....
> Dirc
> --
>
Do you have anti-virus software running? You stated that you are the
only one changing the bin folder...but if you have anti-virus software
running it could be touching the bin folder. We had the same problem
with session and disabling the anti-virus s/w fixed the problem.
Rosanne
---
Rosanne's Profile: http://www.highdots.com/forums/m283
View this thread: http://www.highdots.com/forums/t3035507

Session Variable dissappears between post backs on Win 2003

I have a problem with a Session variable that dissapears after a
postback of one of my pages.

This only happens on WIn 2003 servers.. it is fine on my XP dev box.

This page opens in another window, but I have ascertained that is is
definitely using the same session ID.

Nowhere on the page do I clear the session variable.. it is only ever
retrieved... this page only works if it is there.

Has anyone had as similar problem? Any help gratefully received!

Dirc
--Is the Windows 2003 server (you say servers which leads me to ask this) part
of a webfarm? You may be losing sessions as you are moved from one server to
another. If this is a the case one way to fix this would be to store session
state on the SQL Server, if you're using one.

Here's an article on how to move session state to the SQL Server. It's easy
to do and has some other benefits such as users not losing their sessions
even if a server in the farm needs to be restarted, etc.

http://idunno.org/dotNet/sessionState.aspx

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Dirc Khan-Evans" <dirc.khan-evans@.eurorscgskybridge.com> wrote in message
news:uTgSjp$0FHA.3376@.TK2MSFTNGP14.phx.gbl...
> I have a problem with a Session variable that dissapears after a
> postback of one of my pages.
> This only happens on WIn 2003 servers.. it is fine on my XP dev box.
> This page opens in another window, but I have ascertained that is is
> definitely using the same session ID.
> Nowhere on the page do I clear the session variable.. it is only ever
> retrieved... this page only works if it is there.
> Has anyone had as similar problem? Any help gratefully received!
> Dirc
> --
No, no, no..

I mean in multiple environments.. dev, testing and live.

BTW, I have also tried using StateServer, since I have been told it is
more reliable.. but something as simple as this should not happen on a
lightly used test server!

--
Dirc,

Ok, I didn't realize you meant between multiple environments. So, you've
already stated that this is not hapenning on your development box. Is it
happening on the testing and production servers both? Are other developers
deploying code to the testing or production servers at the same time?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Dirc Khan-Evans" <dirc.khan-evans@.eurorscgskybridge.com> wrote in message
news:%23SNpu5$0FHA.3924@.TK2MSFTNGP14.phx.gbl...
> No, no, no..
> I mean in multiple environments.. dev, testing and live.
> BTW, I have also tried using StateServer, since I have been told it is
> more reliable.. but something as simple as this should not happen on a
> lightly used test server!
> --
S. Justin Gengo wrote:

> Dirc,
> Ok, I didn't realize you meant between multiple environments. So,
> you've already stated that this is not hapenning on your development
> box. Is it happening on the testing and production servers both? Are
> other developers deploying code to the testing or production servers
> at the same time?

No.. I am the only one changing anything in the bin folder... I know
where you are coming from.. There are no changes going on that would
cause an IIS restart.

To reiterate: The interesting things to note is that
(a) it always happens with this page.. it is in no way an intermittent
problem,
(b) this only happens when the new page is displayed in another window.
The first page loads fine but after that the session variable totally
dissappears for no apparent reason.. there is no explicit removal of
any Session variables in the code.
(c) It only happens on IIS6/ win 20003 servers. Not XP
(d) The session has the same sessionID for both windows (as expected).

This really smells of a bug to me....

Dirc

--
Dirc,

Ok, here's a test to try. In the first window create a button that, when
clicked, response.writes the session variable to the page.

Open the page and click the button to confirm the session variable is there.
Then open your second page. Click the first page's session variable button
again to see if the session variable has disappeared. I'm wondering if the
pop-up window is somehow using a different session.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Dirc Khan-Evans" <dirc.khan-evans@.[no_spam_please]eurorscgskybridge.com>
wrote in message news:ODVldSI1FHA.1252@.TK2MSFTNGP09.phx.gbl...
> S. Justin Gengo wrote:
>> Dirc,
>>
>> Ok, I didn't realize you meant between multiple environments. So,
>> you've already stated that this is not hapenning on your development
>> box. Is it happening on the testing and production servers both? Are
>> other developers deploying code to the testing or production servers
>> at the same time?
> No.. I am the only one changing anything in the bin folder... I know
> where you are coming from.. There are no changes going on that would
> cause an IIS restart.
> To reiterate: The interesting things to note is that
> (a) it always happens with this page.. it is in no way an intermittent
> problem,
> (b) this only happens when the new page is displayed in another window.
> The first page loads fine but after that the session variable totally
> dissappears for no apparent reason.. there is no explicit removal of
> any Session variables in the code.
> (c) It only happens on IIS6/ win 20003 servers. Not XP
> (d) The session has the same sessionID for both windows (as expected).
> This really smells of a bug to me....
> Dirc
> --
Do you have anti-virus software running? You stated that you are the
only one changing the bin folder...but if you have anti-virus software
running it could be touching the bin folder. We had the same problem
with session and disabling the anti-virus s/w fixed the problem.

--
Rosanne
----------------------
Rosanne's Profile: http://www.highdots.com/forums/m283
View this thread: http://www.highdots.com/forums/t3035507