Hi @Arvind V ,
Unfortunately, I'm afraid I cannot reproduce the problem with the code you've provided. This is my test:
End.aspx button click event:
protected void setSession_Click(object sender, EventArgs e)
{
HttpContext.Current.Session["closed"] = "something test..";
Response.Redirect("/callingPage.aspx");
}
callingpage.aspx webmethod:
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod(EnableSession = true)]
public static string CheckClosed()
{
//bool closed = false;
string sessionContent = string.Empty;
if (HttpContext.Current.Session["closed"] != null)
{
sessionContent = HttpContext.Current.Session["closed"].ToString();
HttpContext.Current.Session["closed"] = null;
//return true;
}
return sessionContent;
}
Ajax method(print the result in console):
$.ajax({
......
success: function (msg) {
// Evaulate result..
console.log(msg.d);
}
});
And finally deployed it on IIS like this:
Here is the result screenshot:
As you can see, it works fine. If possible, could you provide more relevant details? Perhaps you can try clearing your browser cache, as well as redeploying it and restarting IIS to see if the problem still occurs.
Best regards,
Xudong Peng
If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.