开发者

Enabling Windows Authentication in .NET 4 MVC 2

I have an In开发者_JAVA百科tranet site reading the windows user name and using it for authentication in the website.

My code works locally but does not read the login name when hosted using IIS 6 on Windows Server 2003 with anonymous access checked. If I un-check anonymous access then in Firefox I keep getting a pop up for username and password which never ends. In IIS 6 it is set to framework 4 and has its own application pool.

User.Identity.Name -returns blank on the server but works fine locally

web.config: <authentication mode="Windows"/> <identity impersonate="true"/>

I have an older 3.5 webforms site that works fine on the same server..


Look at the Windows account assigned to run the app pool. Does it have authorization to your .Net application?

To use Windows auth, you'll want to un-check anonymous access.

Either remove the impersonate attribute, or set it to false (the default).

You can set the app pool to use the Network Service account and then grant the Network Service account read/write authorization to your MVC folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜