且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

表单身份验证在子文件夹页面中不起作用

更新时间:2023-12-01 21:23:10

For that you have to write some extra <location> in your web.config file as per the example given below



For that you have to write some extra <location> in your web.config file as per the example given below

<location path="Customer/NewToken.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="Customer">
    <system.web>
      <authorization>
        <allow roles="Customer"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="Admin">
    <system.web>
      <authorization>
        <allow roles="SuperAdmin"/>
        <allow roles="Admin"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>







Here path=\"Customer\" and path=\"Admin\" is directory in my case, You can change as per your need




Here path="Customer" and path="Admin" is directory in my case, You can change as per your need