VS 2008 迁移到 VS 2013 时出现 User.Identity.Name 为空的情况

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VS 2008 迁移到 VS 2013 时出现 User.Identity.Name 为空的情况相关的知识,希望对你有一定的参考价值。

参考自:http://stackoverflow.com/questions/19515890/authentication-issue-when-debugging-in-vs2013-iis-express/

user3149240的回答:

I had just upgraded to VS 2013 from VS 2012 and the current user identity (HttpContext.User.Identity) was coming through as anonymous.

I tried changing the IIS express applicationhost.config, no difference.

The solution was to look at the properties of the web project, hit F4 to get the project properties when you have the top level of the project selected. Do not right click on the project and select properties, this is something entirely different.

Change Anonymous Authentication to be Disabled and Windows Authentication to be Enabled.

Works like gravy :)

 

改IIS的config文件也不行,原因是Windows验证在vs2013中默认没有开启,我的问题解决方法是对Project点击属性(F4),然后disable 匿名验证,而把Windows验证开启。

以上是关于VS 2008 迁移到 VS 2013 时出现 User.Identity.Name 为空的情况的主要内容,如果未能解决你的问题,请参考以下文章

在 VS 2008 上启动 OpenCV 2.4.6 时出现致命错误,找不到文件

c# vs2010连接SQLServer2008时出现“未将对象引用设置到对象的实例。”

如何将C#项目从VS2008迁移到VS2017

无法将vs2008连接到tfs2013

将 vs2008 迁移到 vs2012 - 异常 LINQ to SQL 库

VS2013 中使用 CxImage 库时用Unicode编码时出现链接错误