Dan Lewis' Development and Technology Blog

User.Identity.Name is empty / blank when using Windows authentication in ASP.NET MVC 3 Beta

Posted by: djjlewis on: 06/11/2010

If (like me) you have been tearing your hair out wondering why the User.Identity.Name property always returns an empty / blank string when using <authentication type=”Windows”> in the new ASP.NET MVC 3 Beta then the answer is surprisingly simple:

As detailed in the Known Issues section of the release notes, just add the following line to the <appSettings> section of the web.config:

<add key="autoFormsAuthentication" value="false" />

Also, make sure you have the <authentication> type set to “Windows” as above, and (optionally) if using the built-in Visual Studio web server (aka “Cassini”) you can also check the “NTLM Authentication” option in the Properties / Web tab.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


  • Felipe: Excellent!! Great advice! it worked for me
  • luckybhumkar: Your help solved my problem thanks buddy for this nice hellp!
  • Craig: Thanks, this saved some troubleshooting time. Got to love those descriptive error messages.

Categories

Follow

Get every new post delivered to your Inbox.