I have created a button that will load a page that contains a PDF document that users can fill out and save. After the save is clicked, the page posts-back and there is code to save the changes. However, I'm not able to get the session to preserve the value after postback. I have it enabled on the site and in the web.config. When the button is initially clicked and the page with the PDF is loaded, the ItemId gets pulled from the query string and stored in the session state variable. The next the page posts-back is when the user clicks the button to save the PDF, but at this point, the session state gets reset and even gets assigned a new unique identifier. Does anyone know a way to prevent this from happening?
protected void Page_Load(object sender, EventArgs e)
{
itemId = Request.QueryString["ItemId"];
if (Session["ItemId"] == null || Session["ItemId"] != itemId){
//HttpContext.Current.Session["ItemId"] = itemId;
Session["ItemId"] = itemId;
}
if (!PostBackFromPDF())
{
//-- Generate the pdf or display pre-existing message
GenerateOutput(itemId);
}
else
{
string savedValue = string.Empty;
if (Session["ItemId"] != null)
{
savedValue = Session["ItemId"].ToString();
itemId = savedValue;
}
//-- Post Back From PDF Form
ProcessReportAction(itemId);
}
}
Thanks in advnce