Skip to content

Session gets null in masterpage

mary jean ligas

mary jean ligas

Asked Jan 13, 2014, 7:37 PM EST8 answers
Share
LinkedInX
Need your help my session gets null when my page reload..please help me

6 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Devinder Kumar
    0
    Can you paste code here so i can review where you doing mistakes
    0
  • Devinder Kumar
    0
    in this file there is no error ,,,i think you are doing mistake on another area,,,

    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.
    0
  • mary jean ligas
    0
    Same error occured still the error are there..T_T
    0
  • Biswa Pujarini Mohapatra
    0
    can you paste the code where you assign the value to Session["NickName"] ?
    0
  • mary jean ligas
    0
    upon login I Already pass the parameter in session:
    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();



            }

    {
    0
  • Biswa Pujarini Mohapatra
    0


    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

    0
  • 2 short replies
    • mary jean ligas
      0
      Heres my snippet..
      0
    • mary jean ligas
      0
      Please help me on my code
      0