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.com> wrote in message
news:On8wkwVRHHA.1212@.TK2MSFTNGP03.phx.gbl...

> 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:
> "Sam" <askhuy@.yahoo.com> wrote in message
> news:On8wkwVRHHA.1212@.TK2MSFTNGP03.phx.gbl...
>
> 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.ch> wrote in message
news:utzyUrWRHHA.4896@.TK2MSFTNGP04.phx.gbl...

> 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.com> wrote in message
news:On8wkwVRHHA.1212@.TK2MSFTNGP03.phx.gbl...
> 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