Using anonymous and basic authentication in the same folder under IIS7

China☆狼群 提交于 2019-12-07 11:02:13

问题


I have a have Winforms client that uses Web services on a IIS7 (W2008)

The client will first access a first.asmx page with anonymous aaccess, then access second.asmx with basic authentication (over SSL). This works fine in IIS6 where I can set first file to have anonymous authentication and the second file to have basic authentication.

When I move to IIS7 there seems to be a problem having two different authentication modes in the same virtual folder. Does anyone know how this is intended to work?

I have thought about fixing this with ACLs but it seems tricky.. or maybe move the anonymous first.asmx file to its own virtual folder. Any thoughts?

Regards Fredrik


回答1:


check this out Did you know: Enable File Level Authentication in IIS 7 / 7.5

you can manually set the Authentication by go to the Content View -> right click on the file and click "Switch to Features View"

optionally, we can directly add the authentication for individual web pages in the applicationHost.config file

<location path="Default Web Site/iisstart.htm">
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="true" />
                <basicAuthentication enabled="false" />
                <windowsAuthentication enabled="false" />
            </authentication>
        </security>
    </system.webServer>
</location>
<location path="Default Web Site/welcome.png">
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
                <basicAuthentication enabled="true" />
                <windowsAuthentication enabled="false" />
            </authentication>
        </security>
    </system.webServer>
</location>

Regards, Vivek.



来源:https://stackoverflow.com/questions/1645562/using-anonymous-and-basic-authentication-in-the-same-folder-under-iis7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!