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

Is it possible to convert between Socket and TcpClient objects?

Here's another C#/.NET question based merely on curiousity more than an immediate need ... If you had a Socket instance and you wanted to wrap it in the higher-level TcpClient class, is that possible and how would you do it? Conversely if you have…
Neil C. Obremski
  • 18,696
  • 24
  • 83
  • 112
12
votes
4 answers

System.Net.WebClient fails weirdly

I am trying to download some data from the reporting services instance on our TFS server. Given that the code should run on a computer that is not domain-joined, I figured that I would set the credentials myself. No luck, got a HTTP 401…
Erling Paulsen
  • 593
  • 2
  • 5
  • 11
11
votes
1 answer

HttpWebRequest.UserAgent : What does it do

I read this MSDN like about it and ran its example. http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.useragent.aspx when I change the uSerAgnet to something like "blah", the output is wrong but when I use the same thing that is in…
Bohn
  • 26,091
  • 61
  • 167
  • 254
11
votes
2 answers

WebClient UploadFileAsync strange behaviour in progress reporting

i need some help with strange WebClient.UploadFileAsync()'s behaviour. I'm uploading a file to a remote HTTP Server (nginx) usind POST Method. The POST is processed trough a PHP script (which Address refers to). I have this simple code public…
CrAsHeR
  • 218
  • 3
  • 10
10
votes
3 answers

What does Dns.GetHostEntry Method(String) actually do?

I can't find any proper description in the documentation for what this actually does. Does it check for the existence of A records or CNAME records or both? My understanding is that in .NET 4, this throws a SocketException if the host does not…
Greg Tarr
  • 496
  • 3
  • 5
  • 19
9
votes
2 answers

Post multiple files and form values using .NET (console application)

I want to POST multiple files and form variables to a CGI script, all in one HTTP request. I believe this requires a HTTP post with multipart/form-data encoding. Here is a sample HTML form that sends the required information; I need to send the same…
Salman A
  • 262,204
  • 82
  • 430
  • 521
9
votes
3 answers

Converting the content of HttpResponseMessage to object

My Question: How do I do this? So, I hadn't touched anything .Net in about 6 years until this week. There's a lot that I've forgotten and even more that I never knew and while I love the idea of the async/await keywords, I'm having a slight problem…
copolii
  • 14,208
  • 10
  • 51
  • 80
8
votes
3 answers

FileNotFoundException: Could not load file or assembly 'System.Net.Http.WebRequest'

I've downloaded the latest .NET Framework and I'm working on .NET Core 2.0 Application on VS 2017 15.8.7. Here are the packages I've installed. using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials)) { } I'm getting…
MAK
  • 1,250
  • 21
  • 50
8
votes
3 answers

.NET Core Configuration - System.Net connectionManagement/maxconnections?

I am migrating a console app (REST client app) from .NET framework to .NET Core. In my current (framework) version, I use the app.config file to set the System.Net configuration:
mholberger
  • 337
  • 3
  • 14
7
votes
6 answers

How to speed up slow / laggy Windows Phone 7 (WP7) TCP Socket transmit?

Recently, I started using the System.Net.Sockets class introduced in the Mango release of WP7 and have generally been enjoying it, but have noticed a disparity in the latency of transmitting data in debug mode vs. running normally on the phone. I am…
Pretzel
  • 8,141
  • 16
  • 59
  • 84
7
votes
2 answers

Do we need to close the System.Net.WebRequest's ResponseStream?

I was wondering will I end up having any unclosed streams from this code: Public Function [Get](ByVal url As String) As String Using reader = New System.IO.StreamReader(System.Net.WebRequest.Create(url).GetResponse.GetResponseStream) …
Pacerier
  • 86,231
  • 106
  • 366
  • 634
7
votes
4 answers

Using "System.Net.Dns.GetHostEntry()" to get the IP address for a website, will give different results compared to some online IP checker sites

I am working on a c# console application, and inside my console application, i have the following code, to get the IP for a website:- using System.Net using System.Web; using System.IO; namespace MyConsoleApp { class Program { static…
John John
  • 1
  • 72
  • 238
  • 501
7
votes
1 answer

Giving an authentication denied message in httplisteners authenticationselectordelegate

I'm currently using the httplistener authenticationselector delegate to do windows auth and ip checking and it's working brilliantly in that it denies and allows exactly the clients it should be. However, the problem is that when someone gets…
Nick
  • 920
  • 1
  • 7
  • 21
7
votes
4 answers

C# convert string to dictionary

I get this response string from the Bitly api: { "status_code": 200, "status_txt": "OK", "data": { "long_url": "http:\/\/amazon.de\/", "url": "http:\/\/amzn.to\/1mP2o58", "hash": "1mP2o58", "global_hash": "OjQAE", …
lukas
  • 2,300
  • 6
  • 28
  • 41
7
votes
1 answer

Simple Task-returning Asynchronous HtppListener with async/await and handling high load

I have created the following simple HttpListener to serve multiple requests at the same time (on .NET 4.5): class Program { static void Main(string[] args) { HttpListener listener = new HttpListener(); …
tugberk
  • 57,477
  • 67
  • 243
  • 335
1
2
3
19 20