我正在ASP.NET MVC 3测试版中创建一个Intranet站点,并希望专门使用Windows身份验证。另外,我想在VS2010中使用Visual Studio开发服务器。
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
但是,当我启动我的站点并获得默认页面时,会得到以下答复:
HTTP/1.1 302 Found
Server: ASP.NET Development Server/10.0.0.0
Date: Tue, 02 Nov 2010 14:05:19 GMT
X-AspNet-Version: 4.0.30319
Location: /Account/Login?ReturnUrl=%2f
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 145
Connection: Close
这将导致我的浏览器中出现以下消息:
“/”应用程序中的服务器错误。
找不到资源。
描述:HTTP 404。资源
依赖项)可能已被删除,
名字改了,还是
暂时不可用。拜托
拼写正确。
请求的URL:/帐户/登录名
版本信息:Microsoft.NET
框架版本:4.0.30319;ASP.NET
版本:4.0.30319.1版本:4.0.30319.1
如果在“使用Visual Studio Development Server”下的项目属性中选择“NTLM身份验证”,则在连接时正确收到此答复:
HTTP/1.1 401 Unauthorized Server
ASP.NET Development Server/10.0.0.0
Date: Tue, 02 Nov 2010 14:07:37 GMT
Content-Length: 1211
WWW-Authenticate: NTLM
我认为这只是清除一些默认值的问题,但不确定(“/Account/Login”不会出现在web.config文件的任何地方)。如果我删除“拒绝”部分,那么一切正常,除了我没有获得经过身份验证的主体并且有效地保持匿名。
我知道我可能遗漏了一些基本的东西。谢谢!
注意
Problem restricting anonymous access to an ASP.Net MVC Site
“问题,但不同的是,我只想使用Windows身份验证。