[Solved] Session lost after Response Redirect in ASP.Net

rakeshkuma
 
on Aug 25, 2021 01:54 AM
924 Views

Session loosing after Response Redirect in Asp.Net

Default.aspx Code Behind

protected void btnsubmit_Click(object sender, EventArgs e)
{
    HttpContext.Current.Session["username"] = txtusername.Text;
    Response.Redirect("~/Dashboard.aspx", false);
}

  Dashboard.aspx Code Behind 

protected void Page_Load(object sender, EventArgs e)
{
    lblusername.Text = Session["username"].ToString();
}

IIS 8.0 Setting Session State -> In process -> Cookies Mode -> Use Cookies -> Time-out = 60 .NET Framework 4.0

Download FREE API for Word, Excel and PDF in ASP.Net: Download