(407) Proxy Authentication Required RRS feed

  • Question




    I am trying to access the sample code provided in Health Vault for the first time. I am inside a corporate firewall and have a proxy IP enabled as per the guidelines. But when I try to login the request gets redirected after authenticaltion for my live ID and i get a error message "The remote server returned an error: (407) Proxy Authentication Required"

    Any help in this regard will be appreciated.



    Shekhar Kanade


    Please find below Stack trace for the same

    [WebException: The remote server returned an error: (407) Proxy Authentication Required.]
       Microsoft.Health.EasyWebRequest.StartPostRequest() +372
       Microsoft.Health.EasyWebRequest.Fetch(Uri url) +320
       Microsoft.Health.EasyWebRequest.Fetch(Uri url, IEasyWebResponseHandler customHandler) +64
       Microsoft.Health.HealthServiceRequest.ExecuteInternal() +122
       Microsoft.Health.HealthServiceRequest.Execute() +91
       Microsoft.Health.Authentication.Credential.MakeCreateTokenCall(String methodName, HealthServiceConnection connection, Collection`1 appIdCollection) +585
       Microsoft.Health.Authentication.Credential.MakeCreateTokenCall(String methodName, HealthServiceConnection connection, Guid appId) +113
       Microsoft.Health.Authentication.Credential.CreateAuthenticatedSessionToken(HealthServiceConnection connection, Guid appId) +456
       Microsoft.Health.Web.Authentication.WebApplicationCredential.AuthenticateKeySetPair(AuthSessionKeySetPairs keySetPairs, HealthServiceConnection connection, Guid applicationId) +411
       Microsoft.Health.Web.Authentication.WebApplicationCredential.AuthenticateKeySetPair(HealthServiceConnection connection, Guid applicationId) +74
       Microsoft.Health.Web.Authentication.WebApplicationCredential.Authenticate(HealthServiceConnection connection, Guid applicationId) +70
       Microsoft.Health.Web.Authentication.WebApplicationCredential.AuthenticateIfRequired(HealthServiceConnection connection, Guid applicationId) +169
       Microsoft.Health.AuthenticatedConnection.Authenticate() +91
       Microsoft.Health.Web.HealthServicePage.GetPersonInfo(String authToken) +140
       Microsoft.Health.Web.HealthServicePage.HandleTokenOnUrl() +150
       Microsoft.Health.Web.HealthServicePage.InitializeUserData(Boolean logOnRequired) +46
       Microsoft.Health.Web.HealthServicePage.OnPreLoad(EventArgs e) +62
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2795


    Thursday, April 10, 2008 4:10 AM


  • hi,


    I modified the web.config file for the HelloWorld program by adding

    useDefaultCredentials="true" and this worked. Not sure if this is the recomended solution but this works for me to proceed.




    Wednesday, April 16, 2008 6:11 AM

All replies

  • hi Shekhar -

    Try uncommenting following in the web.config of the sample you are trying use -

      <!-- For running inside networks that use proxy servers (for security) you will need to explcitly specify the proxy address
           in the XML section below.
           The example settings below show how to configure the sample for running inside Microsoft's corporate network.
           Your network settings are likely to be similar (but with a different proxy address)
        <defaultProxy enabled="true">

    Also, you can use the Troubleshooter utility in SDK for making sure that your environment is setup correctly.

    Hope this helps.

    Thursday, April 10, 2008 5:31 PM
  • hi Vaibhav,


    Thanks for your response. I tried uncommenting the proxy section in the web.config file. I also specified specific proxy addess which is opened for outbound ports but with no luck.


    Lastly i tried using the Troubleshooter utility. Got this error.


    Server Access Information
    This section shows the results of trying to access Microsoft.com and the consumer and developer HealthVault servers.

    Microsoft.com Connection error (possible network or proxy problem)
    ShellUrl Connection error
    HealthServiceUrl Connection error

    Troubleshooting Status
    3 errors found


    I think there is some problem with the settings on our proxy server but somehow our network team is unable to figure it out. Please let me know if you are aware of any such changes

    Friday, April 11, 2008 5:13 AM
  • I changed the code in WebsiteReachable class as given below and this worked. Is there any way i can do this change for other sample exaples?

    WebProxy proxyObject = new System.Net.WebProxy("http://MyProxy/", true);

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);

    proxyObject.Credentials = CredentialCache.DefaultCredentials;

    request.Proxy = proxyObject;




    Friday, April 11, 2008 8:52 AM
  • When you tried modifying the proxy earlier did you happen to recycle the asp.net web server? If the WebProxy part worked, I'd expect the web.config modifications to work as well.

    Tuesday, April 15, 2008 4:34 PM
  • hi,


    I modified the web.config file for the HelloWorld program by adding

    useDefaultCredentials="true" and this worked. Not sure if this is the recomended solution but this works for me to proceed.




    Wednesday, April 16, 2008 6:11 AM
  • Where specifically did you insert the useDefaultCredentials = " true " inside the web.config?  We're having troubles getting past the corporate proxy server as well..

    Monday, May 11, 2009 8:59 PM