I have the following code from the site master (where the login form is)
protected void btnLogin_Click(object sender, EventArgs e)
{
string dt = DateTime.Now.ToString();
Response.Cookies["LastLogin"].Value = dt.ToString();
Response.Cookies["LastLogin"].Expires = DateTime.Now.AddDays(365);
}
So basically I save the current datetime in a cookie when a users logs in.
Then in the profile review page, I wrote the following:
protected void Page_Load(object sender, EventArgs e) {
if (!Page.IsPostBack)
{
if (Request.Cookies["LastLogin"] != null)
{
lblMessage.Text = Request.Cookies["LastLogin"].Value;
}
}}
The thing is that it works (it displays the date and time), but not for the previous log in but for the actual login, obviously, but thats why I'm asking - How can I solve this without having to do anything with database? How can I not "override" the previous value but also save the new one?