Click here to Skip to main content
12,507,674 members (51,799 online)
Rate this:
 
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 21: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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 12 Aug 2012
Copyright © CodeProject, 1999-2016
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