Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cookie not created, but it is
Message
From
14/02/2019 10:56:56
 
 
To
All
General information
Forum:
C#
Category:
Coding, syntax and commands
Title:
Cookie not created, but it is
Miscellaneous
Thread ID:
01666381
Message ID:
01666381
Views:
45
Hey all

I'm creating a cookie in my login page that holds the UserID and the AccessLevel.
          HttpCookie ISYSInfo = new HttpCookie("ISYSSettings");
          ISYSInfo.HttpOnly = true;
          ISYSInfo["UID"] = TxtUserID.Text;
          ISYSInfo["UserLevel"] = UserLevel.ToString();
          Response.Cookies.Add(ISYSInfo);
Debugger says it exists - all fine and dandy

When I get to the next page and go to make sure that the person has logged into the system (as opposed to just bookmarking the page), I do this
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
      ViewState["RefUrl"] = Request.UrlReferrer.ToString();
      //string Uname = Session["UID"].ToString();
      HttpCookie reqCookies = Request.Cookies["ISYSInfo"];
      if (reqCookies == null)
        Response.Redirect("ISYSLogin.aspx");
      else
      {
        string Uname = reqCookies["UID"].ToString();
        string AccessLevel = reqCookies["UserAccess"].ToString();
        int UserAccess = Convert.ToInt32(AccessLevel);
      }
      GetUserInformation();
    }
  }
I get redirected back to the Login page because the cookie is null. Everything I've read on the subject says that is all I need to do, but it's ain't working. What am I missing?

TIA
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Reply
Map
View

Click here to load this message in the networking platform