title: Using Windows Authentication with ASP.NET MVC
body: <p>I am sure this is a basic answer, but my search powers are not helping me today.  I have an ASP.NET MVC 2 (.NET 3.5) application.  It is hosted on IIS 6.</p>
  
  <p>For the sake of this question I have two urls.</p>
  
  <p><a href="http://example.com/" rel="nofollow">http://example.com/</a></p>
  
  <p><a href="http://example.com/admin" rel="nofollow">http://example.com/admin</a></p>
  
  <p>I want admin to be available to any user on the domain, and the root to be available to all users.  The server is on the domain but the domain is example1.com, so they are not the same.</p>
  
  <p>Since this is ASP.NET MVC there is no Admin folder to set rights on.  I have tried setting the whole site to block anonymous request and have had it allowing all request.  Then in the web.config I set it up to deny unauthenticated users in the admin folder and/or allow anonymous access to the root.</p>
  
  <p>What I end up getting is a login prompt that doesn't work.  I've tried the user name and example1\username but it always fails to login.</p>
  
  <p>What am I missing?</p>
  
  <p>==== Clarification/Answer ====
  Pandincus gave a great code suggestion, adding [Authorize] to the class is a very clean way to make this work.  However my problem ended up being the fact that I was doing all of this on the same box. I had a HOSTS entry for example.com on my box and was hitting it via the URL.  When I put a HOSTS entry on my other box and hit the site it allowed me to log in without issue.  My question was slightly incomplete as I should have mentioned this and the fact that <a href="http://localhost/" rel="nofollow">http://localhost/</a> was working just fine. </p>