自动重定向到会话过期页面 [英] Auto redirect to the session expires page

查看:123
本文介绍了自动重定向到会话过期页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Web应用程序中,我们使用表单身份验证。



这里我生成一个FormsAuthenticationTicket 10分钟。

如果我们保持网页理想的10分钟,如果我们刷新页面重定向到登录页面。



这里的每件事都很好。



但新要求是相同的场景(FormsAuthenticationTicket有10分钟。)如果网页理想的一两分钟它应该自动重定向到会话过期页面。



在此会话到期页面中,我们将有登录链接按钮。一旦我们点击这个登录页面就必须进入登录页面。



请解释我如何实现这个

In My Web application we are using Forms authentication.

Here I am generating one FormsAuthenticationTicket with 10 minutes.
If we keep web page ideal for 10 minutes, if we refresh the page its redirecting to the Login page.

here every thing works fine.

But the new requirement is same scenario(FormsAuthenticationTicket with 10 minutes.) if the web page is ideal for one or two minutes it should be automatically redirect to session expires page.

In this session expires page we will be having login link button. once we click this login it has to go the login page.

Please explain me how can I achieve this

推荐答案

我假设您有一个 SessionExpired.aspx 页面,那么您需要在页面的aspx(而不是.cs)的head部分中添加一行。 (我假设你已经实现了母版页,所以它只会在母版页上添加)

I assume you have a SessionExpired.aspx page,then you need to add just a single line in head section in aspx (not .cs) of your pages.(I assume you have implemented master pages, so it will be added only at the master page)
<meta http-equiv="refresh">
   content="600;url=http://yourdomain.com/SessionExpired.aspx" /></meta>



此行会自动将浏览器重定向到 SessionExpired 600秒后的页面,即10分钟。


This line will automatically redirects the browser to SessionExpired page after 600 seconds, i.e. 10 minutes.


这篇关于自动重定向到会话过期页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆