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>
精彩评论