我正在尝试使用 asp.net mvc 3 创建一个 Intranet 模板站点,它允许经过 Windows 身份验证的用户登录和查看该站点,以及允许未经身份验证的用户访问该站点,但更少。
我的问题与此类似:Using Windows Authentication with ASP.NET MVC我试过解决方案,我的 web.config 文件设置为 Windows 身份验证。我在必要时使用 Authorize 属性,但即使我没有 Authorize 属性,未经身份验证(公共(public))用户也无法查看 Controller 服务的页面时,问题似乎也出现了。
该帖子的答案暗示,但无济于事。
Any controllers without an [Authorize] attribute should be open to the public automatically. So, only put your attribute on the controllers you want to lock down.
可能因为我使用的是 MVC 3 而不是 MVC 2,所以我可能会得到不同的结果,但我找不到答案。
此链接也可能有帮助:
http://msdn.microsoft.com/en-us/library/gg703322(v=vs.98).aspx http://www.asp.net/mvc/tutorials/authenticating-users-with-windows-authentication-vb
最佳答案
您需要更改 IIS 的设置以允许匿名访问,而不是更改 Controller 中的任何内容。
关于c# - 在经过 Window 身份验证的 Intranet 站点中允许未经身份验证的 ASP.NET MVC 3 用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6446628/