Need your help my session gets null when my page reload..please help me
Session gets null in masterpage
6 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Devinder KumarRank #3,050 · 465 pointsPosted Jan 13, 2014, 7:44 PM EST
Devinder KumarRank #3,050 · 465 pointsPosted Jan 14, 2014, 1:56 AM EST
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 ligasRank #4,658 · 330 pointsPosted Jan 16, 2014, 8:46 PM EST
Biswa Pujarini MohapatraRank #463 · 5.4K pointsPosted Jan 16, 2014, 8:59 PM EST
mary jean ligasRank #4,658 · 330 pointsPosted Jan 16, 2014, 9:10 PM EST
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 MohapatraRank #463 · 5.4K pointsPosted Jan 17, 2014, 12:18 AM EST
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
2 short replies
mary jean ligasRank #4,658 · 330 pointsPosted Jan 13, 2014, 7:58 PM EST
mary jean ligasRank #4,658 · 330 pointsPosted Jan 13, 2014, 9:57 PM EST