title: By Passing Windows Authentication in ASP.NET application
body: <p>My ASP.NET MVC2 application uses windows authentication, using LDAP server and its authenticating users from active directory. The standard format of user name is something like ABCD\UserID, however when i am downloading the code from TFS Server to my local, my local system uses account something like INDIA\userid. Now the problem that i am facing is when i am running the code on my local due to windows authentication its taking the user INDIA\userid which do not have the privilege to the application (as the user id is not available in Active Directory) and i am not able to debug the code as its taking me again and again to request access page. Is there any way to bypass this. I have tried the following means however no one worked:</p>
  
  <ol>
  <li><p>Tried changing Authentication mode from Windows to Forms.</p></li>
  <li><p>Tried creating Virtual Directory and hosted the application on local machine.</p></li>
  <li><p>Tried changing the following:</p></li>
  </ol>
  
  <p></p>
  
  <pre><code>&lt;add key="LDAPServer" value="ABCD"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>to </p>
  
  <p></p>
  
  <pre><code>&lt;add key="LDAPServer" value="INDIA"/&gt;
  </code></pre>
  
  <p></p>
  
  <ol>
  <li><p>Tried bypassing the Active Directory authentication.</p></li>
  <li><p>Tried hard coding the user id and password in Active Directory authentication page:</p></li>
  </ol>
  
  <p>DirectoryEntry root = new DirectoryEntry("LDAP://" + _server,"UserID","Password",AuthenticationTypes.None);</p>
  
  <ol>
  <li>Tried passing my user id (ABCD\UserID) by hardcoding it in HomeController.cs page:</li>
  </ol>
  
  <p>ViewData["UserName"] = "ABCD\UserId";//User.Identity.Name;</p>
  
  <p>I am stuck and not able to debug my code. Any help in this regard will be really appreciable.</p>
  
  <p>Thanks
  Mukesh</p>