开发者

ASP.NET Role based access

开发者 https://www.devze.com 2023-03-22 08:29 出处:网络
I have the following site structure: What I\'d expect this to do was to deny anyone who isn\'t a logged-in user with the RegisteredUser role, except on Reset.aspx and Validation.aspx, where it woul

I have the following site structure:

ASP.NET Role based access

What I'd expect this to do was to deny anyone who isn't a logged-in user with the RegisteredUser role, except on Reset.aspx and Validation.aspx, where it would allow anyone (logged-in or not) to access, but this isn't the case right now.

Everyone who isn't a RegisteredUser isn't able to access these two pages, what am I doing wrong?

Update Even this won't work:

<?xml version="1.0"?>

<configuration>
  <location path="Reset.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

  <开发者_运维技巧;location path="Validation.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
</configuration>

It doesn't make any sense, isn't this supposed to be the system default?


You do not need to map paths, only file names:

<?xml version="1.0"?>

<configuration>
  <location path="Reset.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
        <deny />
      </authorization>
    </system.web>
  </location>

  <location path="Validation.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

  <system.web>
    <authorization>
      <allow roles="RegisteredUser" />
      <deny users="*" />
    </authorization>
  </system.web>
</configuration>
0

精彩评论

暂无评论...
验证码 换一张
取 消