webconfig身份验证和授权 [英] webconfig Authentication & Authorization

查看:98
本文介绍了webconfig身份验证和授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net网站&我添加身份验证和Web.config文件的授权标签

I have an asp.net website & I add Authentication & Authorization tags to Web.config file

</providers>
    </siteMap>
  </system.web>

  <system.web>
  <authentication mode="Forms">
    <forms loginUrl="~/Fa/LoginPage.aspx" name=".ASPXCOOKIEAUTH" path="/" >
      <credentials passwordFormat="SHA1">

        <user name="Admin" password="1F95EC61B6EF02B5D2B138654DA138BFDBBC7F3C"/>
      </credentials>
    </forms>
  </authentication>
  <authorization>
    <allow users="*"/>
  </authorization>
  </system.web>


  <location path="~/Fa/AdminPage.aspx">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

  <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
</configuration>



问题是,当我手动请求AdminPage.aspx时,我的浏览器显示了它,但是我希望在Web.config
中配置时不会显示AdminPage.aspx.
那么这段代码有什么问题呢?
TnX为您提供帮助



the problem is that when I manually request AdminPage.aspx , my browser shows it , but I expected not to show AdminPage.aspx as I configured it in Web.config

so what''s wrong with this code?
TnX for your help

推荐答案

也许您应该尝试:

maybe you should try:

<allow user="?" />


这篇关于webconfig身份验证和授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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