问题描述
我有一个完美的asp.net Web应用程序。我想稍微调整一下。我已经特定了我的会议。因此,会话到期后,用户将被重定向到登录页面。我想做的是告诉他们为什么他们被重定向再次登录(即会话)。我如何实现它。注意。如果第一次访问登录页面,则错误消息不可见。只有在会话结束时加载页面才会显示它。
我尝试过的事情:
除了在会话到期时将用户重定向到登录页面之外,现在还不能想到任何事情
I have a perfectly working asp.net web application. i want to tweak things a little bit. i have given a specific to my session. Hence, users are redirected to login page after session expires. What i want to do though, is to tell them why they have been redirected to login again(i.e session out). How do i achieve it. Note. if the login page is visited for the first time, the error message is invisible. it only becomes visible when the page is loaded as a result of session time out.
What I have tried:
Cant think of any for now apart from redirecting users to login page when session expires
推荐答案
Response.Redirect("Utility.aspx?SomeKey=1");
并检查登录页面中的查询字符串 page_load
事件,根据您应显示/隐藏消息的价值
and check for the query string in the login page page_load
event , based on the value you shall show/hide the message
protected void Page_Load(object sender, EventArgs e)
{
lblMessage.Visible = false;
var value = Request.QueryString["SomeKey"];
if (value != null)
lblMessage.Visible = true
这篇关于...如何在登录页面上显示会话过期错误消息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!