Note that there are some explanatory texts on larger screens.

plurals
  1. PONameResolutionFailure in Mono but not .NET
    text
    copied!<p>I am making HTTPS POST requests (same problem with HTTP) using C#</p> <pre><code>byte[] byteArray = Encoding.UTF8.GetBytes("var1=blah&amp;var2=hah"); HttpWebRequest request = (HttpWebRequest)(WebRequest.Create("https://www.example.com")); request.Credentials = CredentialCache.DefaultCredentials; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = byteArray.Length; request.Method = "POST"; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); WebResponse response = request.GetResponse(); </code></pre> <p>The preceding code works great in both .NET and Mono when I don't have to go through a proxy. When I have to use a proxy, then it works when run on .NET but in Mono fails with the following</p> <pre><code>WebException: Error: NameResolutionFailure at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in &lt;filename unknown&gt;:0 at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in &lt;filename unknown&gt;:0 </code></pre> <p>Also, running in a browser with the same proxy configuration works fine. Any reason why Mono would throw a NameResolutionFailure while .NET does not? </p> <p>There was a similar stackoverflow question that had a work around of using the direct ip when creating the request and then adding the domain to the request.Host. However, the proxy I have to go through rejects this kind of request. Help!</p> <p>Operating System is Windows 7, Mono version is 2.6.5 </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload