Questions tagged [system.net]

System.Net is a namespace of the .NET framework. It provides a simple programming interface for many of the protocols used on networks today.

System.Net is a namespace of the .NET framework. It provides a simple programming interface for many of the protocols used on networks today.

References

297 questions
1
vote
2 answers

Error when using HttpClient inside DelegatingHandler: The request message was already sent. Cannot send the same request message multiple times

In the code snippet below I am trying to implement a DelegatingHandler. You will notice that in the SendAsync method I am deviating from the conventional practice of passing the request to the InnerHandler... base.SendAsync(request,…
July.Tech
  • 1,336
  • 16
  • 20
1
vote
1 answer

How to use System.Net.WebClient in Visual Studio Code on OS X?

I got a little problem by using the WebClient class in System.Net Everything I got is the reference to System.Net, which is working. But I cannot find any WebClient class. Can somebody help me or has the same problem?
Gabriel
  • 189
  • 2
  • 10
1
vote
0 answers

Correct way to make async web request

Hi I need to write a proper async web request function in C# to get some data in JSON format and deserialize it in strongly typed object. I came up with this solution: public async Task MakeAsyncRequest(string url) where…
Alias
  • 341
  • 2
  • 3
  • 14
1
vote
3 answers

Method not found: 'Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)'

I have a problem regarding NewtonSoft. I have a solution with 3 projects for example. Project A has reference points to Project B and Project C, Project B also has reference points to Project C. Both B and C has NewtonSoft assembly. Project C has…
Jerry
  • 316
  • 5
  • 11
1
vote
0 answers

HttpWebRequest GET returns 'No Content' after successful POST

I'm working on an app that makes a POST to a REST API that returns a URI in its response. I then am to make a GET request to that URI and it is supposed to return HTML content in the response body. However, the GET request returns 'No Content' in…
1
vote
1 answer

Traverse ftp subfolders to get file sizes in C#

Was wondering if you could point me at a right direction on how to achieve this... I'm currently working on an application that will check the filespace consumed in a remote FTP server that has folders, subfolders and files. I managed to get some…
mallows98
  • 1,529
  • 4
  • 22
  • 37
1
vote
0 answers

How to prevent character unescaping with WebClient or HttpWebRequest or any .NET client?

I am making a request to http://translate.google.com/translate_tts?q=da%C3%B1o&tl=es-ES to get an audio recording. When I use System.Net.WebClient, System.Net.Http.HttpClient or WebRequest.Create, the request is sent as…
Frank Schwieterman
  • 24,142
  • 15
  • 92
  • 130
1
vote
0 answers

Microsoft Translator API in Windows Phone 8.1 gives System.Net.WebException

I am developing an Windows Phone 8.1 app which uses the Microsoft Translator API and I am following this tutorial to develop the app. I have acquired an clientID and a clientSecret string and assidned it as follows. String strRequestDetails =…
1
vote
1 answer

TypeInitializationException when setting ServicePointManager.ServerCertificateValidationCallback with tracing off

I'm getting an unhandled TypeInitializationException exception when I try to set ServicePointManager.ServerCertificateValidationCallback += (a, b, c, d) => true; The exception happens when I've got the following (taken from MSDN) in my app.config.…
eoinmullan
  • 1,157
  • 1
  • 9
  • 32
1
vote
2 answers

System.Net issues

When I use code like this: System.Net.WebClient objClient = new WebClient(); string url = "http://google.com"; objClient.DownloadString(url); It takes a couple of seconds for the connection to get established and then the downloading starts. I…
backdoor
  • 13
  • 2
1
vote
2 answers

Creating a ContentType throws an FormatException

I'm working with ContentType class to parse content type (type + encoding) of a webpage. I'm noticed that this input fails (FormatException): text/html; charset: windows-1255 This is the code: using System.Net.Mime; //... ContentType ct; try { …
No1Lives4Ever
  • 6,430
  • 19
  • 77
  • 140
1
vote
1 answer

Xamarin: System.Net.Http does not work in unit tests, but works on device

I am running Xamarin in OSX Yosemite. My problem is that I cannot get System.Net.Http to work at all when writing unit tests. To replicate, one can create a very simple test class: using NUnit.Framework; using System.Net.Http; using…
csvan
  • 8,782
  • 12
  • 48
  • 91
1
vote
2 answers

Post fields and a file using the new System.Net.WebClient

i'm trying to invoke a webapi with the new System.Net.WebClient and didnot found any special examples. The goal is simulate a traditional form post with some fields and a file. how can i do it using the System.Net.WebClient or where can i find some…
Flavio CF Oliveira
  • 5,235
  • 13
  • 40
  • 63
1
vote
0 answers

WebRequest slow even with null proxy

I have the following code : private string DoWebRequest() { WebRequest request = WebRequest.Create("http://thegamesdb.net/scripts/ajax_searchgame.php?searchterm=super+mario+64"); request.Proxy = null; …
Emmanuel Istace
  • 1,209
  • 2
  • 14
  • 32
1
vote
1 answer

(.NET) ServicePoint.IPEndPointDelegate doesn't callback with proxy?

I need to bind the local ip address for an HttpWebRequest (machine has multiple ips). I create the delegate method, and this is called and the ip is bound for requests without a proxy, but once i add proxy details to the request, the callback never…
staff0rd
  • 41
  • 6