Need your help my session gets null when my page reload..please help me
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Biswa Pujarini MohapatraPosted Jan 17, 2014, 5:18 AM
can you debug in your login page that value getting assign to the Session["NickName"] or not
your code is absolutely correct I hope somewhere in your content page_load you are doing the session as null or the value is not assigning to the session
mary jean ligasPosted Jan 17, 2014, 2:10 AM
then the use of that session nickname was design on my Masterpage part like "Welcome Mary Jean" on a header part:
login page:
var login = (from usr in context.Dim_Users
where usr.LoginName == txtUserName.Text.ToUpper().Replace(@"PCPPI\", "")
&& usr.Active == true
&& usr.Plant_PIdx != null && usr.Dept_PIdx != null
select usr).ToList();
if (login.Count > 0)
{
Session["User_Idx"] = login[0].User_Idx;
Session["NickName"] = login[0].NickName;
Session["Admin"] = login[0].Admin;
Session["Dept"] = login[0].Dept_PIdx;
Session["Plant"] = login[0].Plant_PIdx;
Session["UserName"] = login[0].LoginName;
successfullylogin = true;
}
on my MasterPage: I called that session
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lnkUser.Text = Session["NickName"].ToString();
}
{
Biswa Pujarini MohapatraPosted Jan 17, 2014, 1:59 AM
mary jean ligasPosted Jan 17, 2014, 1:46 AM
Devinder KumarPosted Jan 14, 2014, 6:56 AM
So Please check these points...
1) somewhere on any content page are you making null to NickName session.
2.) first content page's page load event fire then master page's load event fire.
3.) are you assigning proper value in NickName session.
mary jean ligasPosted Jan 14, 2014, 2:57 AM
mary jean ligasPosted Jan 14, 2014, 12:58 AM
Devinder KumarPosted Jan 14, 2014, 12:44 AM