ASP.NET MVC 3 Tools refresh recently was released and it includes a new Intranet Visual Studio project template.  This template is basically an ASP.NET MVC 3 template with Windows Authentication enabled (the Internet Application template uses forms based authentication).



I was recently playing with this template and it worked fine in development and even using the IIS 7.x Express Web Server.  However, when I deployed to a real Windows Server 2008 R2 application I saw this "The resource cannot be found" error:



So what is going on?  Notice (from the screenshot above) that we are being redirected to .../Account/Login.  This is a clue that the login/authentication is failing. The controller for login is throwing the error.

If you explicitly actually type in /Home/About you will actually get a rendered page below.  Notice in the top right corner all you see is an exclamation point.  The @User.Identity.Name code in the _Layout.cshtml is blank/NULL and causing the error (shown below that is why you only see "Welcome !"). 



Why is Windows Authentication not working?  It looks to me that this is a bug in the ASP.NET MVC 3 Intranet template....I stumbled upon this by chance, by going through the "known issues" section in the 
ASP.NET MVC 3 release notes.  It mentions that we should add this line (<add key="enableSimpleMembership" value="false" />) to the web.config if we are upgrading from an ASP.NET MVC 2 application.  This has NOTHING to do BTW with Windows Authentication and I tried adding that key in web.config by chance and it properly authenticated me.

After adding the key (and restarting the application pool), ASP.NET MVC 3 properly is able to grab the identity of the user via Windows Authentication.  Basically the appsettings section of the web.config should look like this now:

  <appSettings>
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="enableSimpleMembership" value="false" />
  </appSettings> 

If you receive a "This Resource Cannot be Found" error or the User.Identity.Name is blank or IsAuthenticated is false for an ASP.NET MVC application ensure:

- Windows Authentication is turned on in web.config (IIS 6 and 7)
- You are using the Integrated pipeline mode in the application pool (IIS 6 and 7)
- All the wildcard mappings and ISAPI settings are properly set up (IIS 6)
- Add the key: <add key="enableSimpleMembership" value="false" /> to the appSettings section
- If you have Kerebos/NTLM etc authentication, make sure it is configured correctly in IIS

I hope this article helped anyone who is going through this annoying issue.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.