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


>
>
>

0 comments:

Post a Comment