代码之家  ›  专栏  ›  技术社区  ›  Brian Webster

ASP.NET授权-当用户被拒绝访问时,会将其重定向到登录屏幕,但仍会登录。我怎么能换这个?

  •  1
  • Brian Webster  · 技术社区  · 14 年前

    I've attached the relevant portion of my web.config file below.

    When a user attempts to directly visit the url admin.aspx, and they are not an admin, they are redirected to the login page. However, the user then attempts to visit ViewWeek.aspx, it indicates that they are still logged in.

    为什么此ASP.NET授权会将用户引导到登录屏幕,但仍保持用户登录?我希望它只是将用户引导到表单标记中指定的默认URL。

    谢谢

    Here's my Forms Authentication:

    <预> <代码> &认证模式=“窗体”& gt; 窗体名称=“.ASPXFrame SouthH”Debug,=“VIEWAX.ASPX”超时=“50000000”/gt; < /代码>

    And here's my authorization

    < IMG SRC=“HTTPS://imgur.COM/3HFBU.PNG”ALT=“ALT文本”/>

    When a user attempts to directly visit the url admin.aspx, and they are not an admin, they are redirected to the login page. However, the user then attempts to visit ViewWeek.aspx, it indicates that they are still logged in.

    为什么此ASP.NET授权会将用户引导到登录屏幕,但仍保持用户登录?我希望它只是将用户引导到表单标记中指定的默认URL。

    谢谢

    Here's my Forms Authentication:

    <authentication mode="Forms">
           <forms name=".ASPXFORMSAUTH" defaultUrl="ViewWeek.aspx" timeout="50000000" />
    </authentication>
    

    And here's my authorization

    1 回复  |  直到 14 年前
        1
  •  4
  •   Russ Cam    14 年前

    如果表单身份验证没有足够的权限访问Web应用程序的某些页面,从而使经过身份验证的用户有机会使用其他用户帐户登录,则表单身份验证会将经过身份验证的用户重定向到登录屏幕。

    我通常的方式是在登录页面中有逻辑来检测用户是否已经登录并重定向到登录页面。如果它们处于此状态,则将它们重定向到拒绝访问页。