相关疑难解决方法(0)

如何在未授权时将用户重定向到ASP.NET页面?

我需要将我的用户重定向到AuthError.aspx页面("您无权访问此页面"),如果他们经过身份验证但尝试访问他们无法访问的页面(因为考试的角色) .如果我设置了web.config,那么:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
Run Code Online (Sandbox Code Playgroud)

这是系统的错误行为,因为用户已经过身份验证,无需将他或她重定向到此页面.但是,如果我在这里写AuthError.aspx而不是Login.aspx我怎么能将尚未验证的用户重定向到登录页面?

asp.net authentication authorization

21
推荐指数
2
解决办法
6万
查看次数

标签 统计

asp.net ×1

authentication ×1

authorization ×1