Why Session is null when redirection from one controller to another? And when I refresh the page again I find that the session object is not null and have data!
First controller:
HttpContext.Session["SiteCheckpoint"] = siteCheckpoint;
//redirect to second page controller
Response.Redirect(siteCheckpoint.FirstPageUrl + "?rf =" + referenceId);
Second controller:
if (HttpContext.Session[Resources.SessionParameter.SiteCheckpoint] != null)
{
GetCheckpointData();
}
else
{
//Raise error page
}
I tried this solution but it didn't work:
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>