开发者

apply windows authentication to single folder

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜