[quoted text, click to view] On Feb 5, 10:24=A0am, "Mark Fitzpatrick" <markf...@fitzme.com> wrote:
> Instead of trying to handle it on the server, you may find it much easier =
to
> handle on the client. I've seen this done at sites such as my bank, where
> they warn me my session will end shortly unless I perform some action.
>
> You can't really handle the popup server-side because the user may not eve=
n
> be on the site anymore. Keep in mind, http is a stateless protocol and the=
> user is disconnected from the server the moment the browser finishes
> requesting all the data for the page. That means there's really no user to=
> push data to such as a popup. Handling it on the client can be fairly easy=
> because you know how long the session timeout value is in minutes, and can=
> check that on the browser since the session will timeout at pretty much th=
e
> same time a script on the browser would determine that 20 minutes are up.
>
> --
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP - Expression
>
> "Sems" <ben_camero...@hotmail.com> wrote in message
>
> news:d233bd31-c420-4828-9a77-9c75742108ef@e6g2000prf.googlegroups.com...
>
>
>
> > Hi
>
> > I'm using the Session_End event in the global.asax to detect if a
> > users sessions has ended. Is there any way to tell if the session end
> > is due to it being expired and not abandoned?
> > I'm trying to show the user a popup if their session has expired due
> > to a timeout.
>
> > Whats the best way to do this?
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
for example, I do it like this (within ASPX page)
<!--
----------------------------------------------------------------------------=
--------
-->
<!-- //for user session timeouts: -->
<!-- warn user session is about to expire in 1 min -->
<script type=3D"text/javascript" language=3D"javascript"
src=3D"errors.js">
</script>
<script language=3D"javascript" type=3D"text/javascript">
function ShowTimeoutWarning ()
{
window.alert( "...about to expire..." );
window.location.href =3D "../Default.aspx";
}
<%
//Session.Timeout =3D2;
if ( HttpContext.Current.Session["UserSession"].ToString()!
=3Dnull )
{
Response.Write( "setTimeout('ShowTimeoutWarning();', " +
( Session.Timeout *
60000 ).ToString() + " );" );
}
%>
<!--
----------------------------------------------------------------------------=
--------
-->
* where HttpContext.Current.Session["UserSession"] being set on user