on my first page i create a session
SessionData sd = new SessionData("username" , 2);
Session.Remove("sessionData");
Session.Add("sessionData", sd);
on my second page
SessionData sd = (SessionData) Session["sessionData"];
but the username and id that i entered on the first page are not saved
instead of "username" i get ""
instead of 2 i get 0
Here is the code for SessionData class
public class SessionData
{
public string username;
public int id;
public SessionData (string username, int id)
{
this.username = username;
this.id = id;
}
}
Any idea why I'm losing this data?
NVM I FIXED IT
I was missing some lines of code
Bookmarks