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
2
votes
2 answers

"Program does not contain a static 'Main' method suitable for an entry point" when adding async

So I have been fiddling around with Web responses and requests in C# and I received a problem when I tried to run the program. One of the lines of code I had: var response = await httpClient.SendAsync(request); required async in the method making…
2
votes
2 answers

How to properly add HttpRequestHeaders using system.net.http library

I created a HttpRequestMessage with header using windows.web.http; library: var request = base.CreateHttpRequestMessage(); request.Headers.Add("SESSION", SessionId); return request; and after sending SendRequestAsync(); , I am able…
user7676403
2
votes
1 answer

C# TCP Application won't work

I'm making a simple chat application using TcpClient and TcpServer from System.Net. I got everything working on my PC, the server communicates with the client and vice versa. But when I try to connect to the same server application using another PC…
Michael
  • 548
  • 6
  • 23
2
votes
1 answer

Kanji characters from WebClient html different from actual Kanji in website

So, I'm trying to get a portion of text from a website called Kanji-A-Day.com, but I have a problem. You see, I'm trying to get the daily kanji from the website, and I was able to narrow the HTML down to what I want, but it seems the characters are…
IIRawCodeII
  • 375
  • 1
  • 3
  • 9
2
votes
0 answers

Getting "'SslPolicyErrors' is not defined" when trying to validate SSL certificate in Windows XP

I'm trying to validate an SSL certificate with this code: ServicePointManager.ServerCertificateValidationCallback = New Security.RemoteCertificateValidationCallback(AddressOf CV) Public Function CV(sender As Object, certificate As X509Certificate,…
2
votes
1 answer

.NET Framework 3.5 and System.Net.Http not found

I have a framework 3.5 project containing some asmx files. When I have exception in asmx methods, I want return an error response: try{ ... ... catch (Exception ex) { var errorResponse = new HttpResponseMessage(HttpStatusCode.BadRequest) { …
Daniele
  • 203
  • 6
  • 20
2
votes
0 answers

Using Default Credentials in System.Net.HttpClient request in UWP

We are porting our Windows 8.1 app to UWP and are experiencing an issue with sending default user credentials for single sign-on. It seems that credentials are not being set, despite setting UseDefaultCredentials = true on the handler. This exact…
NSouth
  • 5,067
  • 7
  • 48
  • 83
2
votes
1 answer

HttpWebRequest .Net Core set Timeout

I am trying to set the Timeout on an HttpWebRequest and it seems that it is not possible in .Net Core. The property 'Timeout' is no longer there. Thanks
2
votes
0 answers

can I use System.Net.Http.HttpClient or System.Net.HttpWebRequest for ICAP services

I'm trying to write an ICAP client in .Net C#. The ICAP protocol is described as being "HTTP-like" Has anyone had any success using System.Net.Http.HttpClient or System.Net.HttpWebRequest to invoke ICAP services, or do I have to roll my own layer…
Andy
  • 10,412
  • 13
  • 70
  • 95
2
votes
1 answer

How to download a file with Powershell System.Net.WebClient and custom user-agent string?

I am running the following command to download a file using the Powershell System.Net.WebClient method: powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://domain.name/file.name','C:\file.name')" Is there a way to customize…
slantalpha
  • 515
  • 1
  • 6
  • 18
2
votes
1 answer

Trouble with System.Net on .NET core Ubuntu 14.04

I installed dotnet via sudo apt-get install dotnet I created a project using dotnet new hello-world template. It builds and runs. Architecture: amd64 (dpkg -s) Version: 1.0.0.001598-1 (dpkg -s) Then I wanted to start using the library System.Net…
Wilbur Whateley
  • 201
  • 1
  • 11
2
votes
1 answer

Xamarin.iOS - Could not install package 'System.Net.Http 4.0.0' the package does not contain any assembly references

I am trying to install the NuGet package System.Net.Http on my IOS project. But running into this error: Error: Could not install package 'System.Net.Http 4.0.0'. You are trying to install this package into a project that targets …
SPI
  • 93
  • 12
2
votes
1 answer

Using System.Net.Http methods in ASP.NET 5?

I'm writing an API for mobile clients and an AngularJS web front end using ASP.NET 5. Everything's going well, but I'm stumped on how to create a POST to upload files to the server. The best info I've found is in this thread. Based on the research…
waffles
  • 1,386
  • 12
  • 18
2
votes
1 answer

MockingHttpRequestMessage/HttpContextWrapper

I am trying to unit test the following method with Moq, but I am running into issues with the accessibility of manipulating some properties on these classes, and even mocking them up for that matter. public string…
cdalto
  • 797
  • 1
  • 15
  • 33
2
votes
1 answer

HttpWebRequest referer header lost following redirect

When setting the referer header on an HttpWebRequest I'm seeing two different behaviors. On some sites the referer header will remain as each redirect is followed while on others the referer header is dropped after the first request. What would…
tribus
  • 1,110
  • 1
  • 9
  • 27