Warn user that session expired?

G

Guest

How can I warn a user that their session has expired when they click on a
button etc?
 
S

SevDer

If the session is expired, then in the postback process, simply redirect
them to a custom session expired page which can explain what went wrong.
 
G

Guest

But that will result in information loss if say the user has some textboxes
fille dout etc.

Is there a way to warn a user the session has timedout and not postback in
that case?

I dont think there is a way.
 
S

Siva M

Session timeout is something that happens on server-side. Unless we hit
server, there is no way to find find timeout.

But that will result in information loss if say the user has some textboxes
fille dout etc.

Is there a way to warn a user the session has timedout and not postback in
that case?

I dont think there is a way.
 
G

Guest

yeah and the problem is that as soon as you hit the server the session is
re-set. Catch 22.
 
S

SevDer

Well, you can do through JavaScript and another aspx page.

What you need to do is, make XMLHTTP call to the other aspx page, and in the
aspx page, simply make a simple output.
If the session exists, do Response.Write("OK"); and if it does not exist do
Response.Write("NOTOK");
Also note that, you should not have any HTML on this aspx page, like no form
no body but
<%@ Page language="c#" Codebehind="

I think this will solve your problem.
 
P

Peter Rilling

Or simply have a hidden iframe which pings the server periodically. Then
the server can evaluate the session state and emit the javascript to display
a message box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top