Website error - Proxy Authentication Required
<p>So I'm trying to set up an internal website that requires windows authentication - so that those credentials are used for the proxy server.</p>

<p>The code is calling the Rally API passing in the proxy server settings:</p>

<pre><code>var webProxy = new WebProxy(WebConfigurationManager.AppSettings["WebProxyUrl"], Convert.ToInt32(WebConfigurationManager.AppSettings["WebProxyPort"])) { UseDefaultCredentials = true };

var restApi = new RallyRestApi(username, password, webServiceUrl, webServiceVersion, webProxy);
</code></pre>

<p>After deploying it to the server I get the error message:</p>

<p><strong>The remote server returned an error: (407) Proxy Authentication Required.</strong> </p>

<p>If I change the app pool to use my personal account then the site works ok.  However I don't want my account tied to it.  </p>

<p>It doesn't seem to be prompting me to log in with my windows credentials so I'm wondering if maybe I've stuffed that up.  My web.config contains:</p>

<pre><code>&lt;?xml version="1.0"?&gt;

&lt;!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  --&gt;

&lt;configuration&gt;


  &lt;appSettings&gt;
    &lt;add key="webpages:Version" value="2.0.0.0" /&gt;
    &lt;add key="webpages:Enabled" value="false" /&gt;
    &lt;add key="PreserveLoginUrl" value="true" /&gt;
    &lt;add key="ClientValidationEnabled" value="true" /&gt;
    &lt;add key="UnobtrusiveJavaScriptEnabled" value="true" /&gt;
    &lt;add key="RallyWebserviceUrl" value="https://rally1.rallydev.com" /&gt;
    &lt;add key="RallyWebserviceVersion" value="1.39" /&gt;
    &lt;add key="RallyUsername" value="REMOVED" /&gt;
    &lt;add key="RallyPassword" value="REMOVED" /&gt;
    &lt;add key="RallyPageSize" value="50" /&gt;
    &lt;add key="WebProxyUrl" value="REMOVED" /&gt;
    &lt;add key="WebProxyPort" value="8080" /&gt;
    &lt;add key="BacklogRallyProject" value="REMOVED" /&gt;
    &lt;add key="CurrentWorkRallyProject" value="REMOVED" /&gt;
  &lt;/appSettings&gt;

  &lt;system.web&gt;
    &lt;authentication mode="Windows"/&gt;
    &lt;pages&gt;
      &lt;namespaces&gt;
        &lt;add namespace="System.Web.Routing"/&gt;
      &lt;/namespaces&gt;
    &lt;/pages&gt;
    &lt;profile defaultProvider="DefaultProfileProvider"&gt;
      &lt;providers&gt;
        &lt;add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/&gt;
      &lt;/providers&gt;
    &lt;/profile&gt;
    &lt;membership defaultProvider="DefaultMembershipProvider"&gt;
      &lt;providers&gt;
        &lt;add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/&gt;
      &lt;/providers&gt;
    &lt;/membership&gt;
    &lt;roleManager defaultProvider="DefaultRoleProvider"&gt;
      &lt;providers&gt;
        &lt;add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/&gt;
      &lt;/providers&gt;
    &lt;/roleManager&gt;
    &lt;!--
            If you are deploying to a cloud environment that has multiple web server instances,
            you should change session state mode from "InProc" to "Custom". In addition,
            change the connection string named "DefaultConnection" to connect to an instance
            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
      --&gt;
    &lt;sessionState mode="InProc" customProvider="DefaultSessionProvider"&gt;
      &lt;providers&gt;
        &lt;add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/&gt;
      &lt;/providers&gt;
    &lt;/sessionState&gt;
    &lt;compilation debug="true"/&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
    &lt;validation validateIntegratedModeConfiguration="false"/&gt;
    &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
    &lt;handlers&gt;
      &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/&gt;
      &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/&gt;
      &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0"/&gt;
      &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/&gt;
      &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/&gt;
      &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/&gt;
    &lt;/handlers&gt;
  &lt;/system.webServer&gt;
  &lt;runtime&gt;
    &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/&gt;
        &lt;bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/&gt;
        &lt;bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/&gt;
      &lt;/dependentAssembly&gt;
      &lt;dependentAssembly&gt;
        &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/&gt;
        &lt;bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/&gt;
      &lt;/dependentAssembly&gt;
    &lt;/assemblyBinding&gt;
  &lt;/runtime&gt;

&lt;/configuration&gt;
</code></pre>

<p>Edit - I've also tried setting up windows authentication for the site following most of the steps here:
<a href="http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&amp;id=15739768&amp;linkID=9261340" rel="nofollow">http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&amp;id=15739768&amp;linkID=9261340</a></p>

<p>The dos prompt commands don't work for me.  However the changes now force me to put in my details for authentication - but then fails despite me putting in my username and password correctly (I also had someone else try and it failed for them too).  I think also there are cross-domain issues that might be occurring.  As I can't log on with my username, but if I use a username on the old domain (as the machine is part of the old domain) then that login works - but all the user accounts are on the new domain.</p>
