Nicky Sharma
Nicky Sharma

Reputation: 1

Get Session on current Page after session Time Out

If session was expire then after without going to any where(ex. login Page), how I get session on same page.

Please help me for that I have searching a lot for that but I am not able to find out.

Thnaks in advance, Technoera Team Member

Upvotes: 0

Views: 85

Answers (1)

Arindam Nayak
Arindam Nayak

Reputation: 7462

You are just concerned about getting session stored value from lost session, definitely you can do that. E.g. if you have Session["user"] = "arindam", and session expires, you won't get that.

Solutions, on page load save Session["user"] in an input hidden field.

<input type="hidden" id="hdn" runat="server"/>
document.getElementById("hdn") = "<%= Session["user"] %>";

, on postback if session is lost, then get that value from hdn variable, as Request.Form["hdn"].

Upvotes: 1

Related Questions