如何使用Windows身份验证允许匿名访问我的mvc3应用程序

Nil*_*rar 6 iis windows-authentication anonymous-access asp.net-mvc-3

我有一个使用Windows身份验证的MVC3 Intranet应用程序.我现在正在使用第三方服务,该服务将通知我的应用.我已经为这些API调用创建了一个监听器,但不确定如何在我的应用程序中允许匿名访问该单个视图.

我的IIS7设置如下:

Anonymous - Enabled <---------- Use Domain User
ASP.NET Impersonation - Disabled
Basic Authentication - Disabled
Digest Authentication - Disabled
Forms Authentication - Disabled
Windows Authentication - Enabled - HTTP 401 Challange
Run Code Online (Sandbox Code Playgroud)

此外,在我的web.config文件中,身份验证模式设置为Windows.

话虽如此,有没有办法允许匿名访问我的MVC应用程序中的单个视图?

Pau*_*ing 3

其中路径是您的最终网址,请将其添加到您的 web.config。

<location path="MyController/MyAction">
    <system.web>
        <authorization>
            <allow users="?" />
        </authorization>
    </system.web>
</location>
Run Code Online (Sandbox Code Playgroud)

或者使用AllowAnonymousAttibute http://msdn.microsoft.com/en-us/library/system.web.http.allowanonymousattribute(v=vs.108).aspx修饰操作。