从web.config重定向到root登录页面 [英] redirect to root login page from web.config

查看:58
本文介绍了从web.config重定向到root登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

会话期满后,我将用户重定向到登录页面. Login.aspx 在根目录中.

I am redirect user to loging page when session expires. Login.aspx is in root.

我在web.config文件中声明了这样的路径.

I declared path like this in web.config file.

     <forms name=".FormsAuth" loginUrl="~/Login.aspx"  protection="All" 
slidingExpiration="false" requireSSL="false" >

它适用于所有根 .aspx 页.但不适用于子文件夹页面,如 Reporting \ report.aspx .

It is working for all root .aspx pages. But it not working for sub folders pages like Reporting\report.aspx.

那么如何管理根.aspx页和子文件夹.aspx页的重定向页(Login.aspx)?

So how to manage redirect page (Login.aspx) for root .aspx pages and sub folder .aspx pages?

推荐答案

检查您的配置.在我看来,您的标签Forms没有正确关闭.如果您有这两个部分,则必须工作:

Check your config. It seems to me that your tag Forms is not closed properly. If you have these 2 sections it must work:

<authentication mode="Forms">
    <forms name=".FormsAuth" loginUrl="~/Login.aspx" protection="All" slidingExpiration="false" requireSSL="false" />
 </authentication>

    <authorization>
      <deny users="?"/>
    </authorization>

您可以在此处找到示例应用程序.

You can find a sample app here.

这篇关于从web.config重定向到root登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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