开发者

apply windows authentication to single folder

开发者 https://www.devze.com 2023-04-04 01:46 出处:网络
In my asp.net web application is it possible set 开发者_运维问答up windows authentication on a folder and allow to rest of my site to be access without authentication? Can this be set up via the web.c

In my asp.net web application is it possible set 开发者_运维问答up windows authentication on a folder and allow to rest of my site to be access without authentication? Can this be set up via the web.config of the application and if so, how?


Yes it should be possible. You can try the following:

First, enable Anonymous and Windows Authentication in IIS

Then add a windows <authentication> entry to the web.config

<authentication mode="Windows" />
  <authorization>
   <allow users="*" />
</authorization>

Finally, add a <location> config entry for the folder you would like to secure, denying anonymous users

<location path="pathToSubFolder">
  <system.web>
    <authorization>        
        <deny users="?" />
    </authorization>
  </system.web>
</location>
0

精彩评论

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

关注公众号