title: C# can't make http request from website or service
body: <p>I am trying to write a simple POST request to google-analytics server, here is my code :</p>
  
  <pre><code>        using (var client = new System.Net.WebClient())
          {
  
  
              var values = new System.Collections.Specialized.NameValueCollection();
              //values["v"] = "1";
              //values["t"] = "event";
              //values["tid"] = trackingID;
              //values["cid"] = clientID;
              //values["ec"] = eventCategory.ToString();
              //values["ea"] = eventAction.ToString();
              //values["el"] = eventAction.ToString();
  
              var endpointAddress = "http://www.google-analytics.com/collect";
              var response = client.UploadValues(endpointAddress, values);
  
              var responseString = System.Text.Encoding.Default.GetString(response);
          }
  </code></pre>
  
  <p>This code works fine in a console application, but not on a website application (hosted on IIS or run on Visual Studio 2013) or in a WCF (likewise).
  I checked using </p>
  
  <pre><code>WindowsIdentity.GetCurrent()
  </code></pre>
  
  <p>in both the site, the WCF service and the application, everytime the DOMAIN and USERNAME are my own, so I don't think that is the problem. I have tried using .NET impersonation without success.</p>
  
  <p>I've tried setting the application pool identity to my user, ApplicationPoolIdentity or NetworkService, without success.
  I've also tried changing the authentication mode to AnonymousUser or Windows Authentication. I've tried changing the physical access path, without success.
  I'm at work behind a proxy, at home I've tried it and it worked well.</p>
  
  <p>Does anyone has an idea as to why it doesn't work ?</p>