Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC3
Hi Friends,
 
I have just started the session varibale in my project for the logged in user.
The problem that i am getting is once i set the login id.in the session variable
 
 Session["LoginID"]=userInfo.UserName;
it is not persist on the second page.it is coming blank.
what is the resion behind this.i need that session on the another page also.
 
Please help me.
Thanks
Posted 10-Aug-12 22:36pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I am damn sure that somewhere your session is getting cleared. You need to go through the coding and find the place where it is getting cleared. If your session is coming null then somewhere in code only you are making it null and you forgot about that. If your session is coming empty then check for the value you are assigning to the session. Try this:
if(userInfo.UserName != string.empty)
{
     Session["LoginID"]=userInfo.UserName;
}
else{
    //show error.
}
 

--Amit
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 359
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 12 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100