1
我想玩WindowsAuthentication,但看起来在第一个障碍中倒下了。使用Windows身份验证的ASP.Net WebForms
所以我创建了一个空ASP.Net Web表单应用程序,并修改了web.config中像这样:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<authentication mode="Windows" />
<identity impersonate="true"/>
</system.web>
</configuration>
火起来的应用程序,并在页面加载检查值以下:
HttpContext.Current.User.Identity.Name
但它返回一个空字符串(并且还显示HttpContext.Current.User.Identity.IsAuthenticated
为false)。
我的期望是看到我的Windows帐户名称返回例如mydomain\rob
我在哪里出错了?
使用IIS或ASP.NET开发服务器? – sq33G
我正在使用IIS Express(来自VS)。切换到使用ASP.Net开发服务器,它工作正如我所料... – glosrob