简体   繁体   English

有没有简单的方法在会话超时后重定向到会话过期页面而不重定向到formauthentication loginUrl

[英]Is there any easy way to redirect to session expire page after session timeout without redirecting to formauthentication loginUrl

I know we have form authentication to set loginUrl and when session expires it automatically redirects to this URL. 我知道我们有表单身份验证来设置loginUrl,当会话到期时,它会自动重定向到此URL。

I have a requirement where I have to show different page on session expiration not login.aspx 我有一个要求,我必须在会话到期时显示不同的页面而不是login.aspx

I was searching for it but did not find any suitable easy to implement solutions. 我正在寻找它,但没有找到任何合适的易于实施的解决方案。

I can't prefer to change to existing deployed site code behind and client want to implement this new SessionExpired.aspx page 我不想更改现有的已部署站点代码,客户端希望实现这个新的SessionExpired.aspx页面

I read http://www.schnieds.com/2009/07/aspnet-session-expiration-redirect.html , they have nice solution but I have to make change in .cs file that I don't want to do at least until I get any easy solution. 我阅读http://www.schnieds.com/2009/07/aspnet-session-expiration-redirect.html ,他们有很好的解决方案,但我必须在.cs文件中进行更改,至少我不想做直到我得到任何简单的解决方案

Is there any easy way to redirect to session expire page after form authentication timeout without redirecting to loginUrl? 有没有简单的方法在表单身份验证超时后重定向到会话过期页面而不重定向到loginUrl?

After creating the SessionExpired.aspx page you need to add just a single line in head section in aspx (not .cs) of your pages. 创建SessionExpired.aspx页面后,您需要在页面的aspx(而不是.cs)的head部分中添加一行。 (I hope you have implemented master pages, so it will be added only at the master page) (我希望你已经实现了母版页,因此它只会在母版页上添加)

<meta http-equiv="refresh"
   content="1201;url=http://yourdomain.com/SessionExpired.aspx" />

This line will automatically redirects the browser to SessionExpired page after 1201 seconds, ie 20 minutes 此行将在1201秒(即20分钟)后自动将浏览器重定向到SessionExpired页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM