当asp.net会话超时通知用户 [英] Notify user when session time out in asp.net
本文介绍了当asp.net会话超时通知用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是显示一个消息给用户会话结束后最好的方法是什么?
届时,用户应该注销并重定向到起始页。
我可以使用JavaScript重定向用户启动页面。我只是想表明起始页面的讯息。
What is the best way to show a message to user after session is expired? By then, the user should be logged out and redirected to start page. I can use javascript to redirect user to start page. I just want to show a message on start page.
推荐答案
在你的JavaScript重定向查询参数添加到您的重定向URL。
In your JavaScript redirect add a querystring parameter to your redirect URL.
<script>
...
// If session is about to timeout...
location.href = '/home.aspx?action=expired';
...
</script>
然后在你的起始页,你可以有code,检查查询字符串,并显示一条消息,如果是这样的话。
Then in your start page, you can have code to check the querystring and display a message if that's the case.
<%
'home.aspx
If Request.QueryString("action") = "expired" Then
Response.Write("<p>You have been logged out due to inactivity.</p>")
End If
%>
这篇关于当asp.net会话超时通知用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文