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
0 answers

What is the relationship between ServicePointManager.DefaultConnectionLimit and system.net connectionManagement maxconnection?

Do these two settings refer to the same limit or seperate limits? (don't fixate on the number, I put that in at random) System.Net.ServicePointManager.DefaultConnectionLimit = 20; The above property which can be set in code, and the optional…
Andrew M
  • 9,149
  • 6
  • 44
  • 63
1
vote
2 answers

MemoryStream from HttpContent without copying

I m trying to use System.Net.Http for POST requests. I m ok with HTTP response body being in memory but need to obtain MemoryStream for it. One way to do that would be to call HttpContent.GetAsByteArrayAsync() and wrap a MemoryStream on top of it,…
Yevgeniy P
  • 1,480
  • 1
  • 15
  • 23
1
vote
0 answers

C# Is the TcpListener limited to local area network or is something wrong with my code?

I have a problem with my chat app : it doesn't work over the network . I tried port-forwarding and other similar methods. I'm starting to question my code . I'm new to networking so please help me with this. I heard of another method using…
1
vote
1 answer

Politely checking to see if a file exists before downloading

I'm trying to download files using the Net.WebClient call to DownloadFile Using client As New Net.WebClient() Try client.DownloadFile(PDFURL, FullPDFFilePath) I then catch the exception and check the message for 403, 404, or 500 errors…
cometbill
  • 1,619
  • 7
  • 19
  • 41
1
vote
0 answers

Response URL is returning previous Imgur image URL instead of current image URL

I've built a new Unity project that makes use of C# and System.Net to access Imgur's API. I'm able to pull images into my application from anywhere, and I can upload screenshots to Imgur through my new application's client ID. I'm able to get a…
RMGCode
  • 11
  • 2
1
vote
2 answers

How do I resolve 302 Error when using HttpClient?

I've created a custom DNN module that uses HTTPClient to send information to an external API. My HttpClient method is as follows: public static async Task CreatePayerResponse() { var credentials = GetCredentials(); var…
SidC
  • 3,175
  • 14
  • 70
  • 132
1
vote
2 answers

SocketException 'the connected party did not properly respond after a period of time' when connecting to server using public ip (C#)

I'm trying to create a server using C#. Currently, I have two programs, a server and a client both of which work correctly when they are both run on the same computer, the server's TcpListener is created using the ip 127.0.0.1 (localhost) and the…
1
vote
1 answer

C# Systems.Net library vs. command line networking tools

For part of a C# application I am executing some relatively simple networking commands. (ping, ipconfig, tracert, nslookup, etc.) I have read this answer on when to use C# vs CMD/PowerShell in the general…
Birdman
  • 1,404
  • 5
  • 22
  • 49
1
vote
0 answers

Is this the right way of using System.Net?

My Post Method for System.Net is public string Post(string url, string postdata, string referrer = "https://accounts.epicgames.com/login?productName=epic-games&redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fsite%2Fen-US%2Fhome&noHostRedirect=true",…
KeCa
  • 11
  • 3
1
vote
0 answers

ETW Manifest files - finding more information on the values?

I'm troubleshooting the windows Networking stack and using Perfview/ETW to do it. I'm particularly interested in some values that appear in the manifest for the event source Microsoft-Windows-TCPIP. I can get the manifest with no problem using…
g0pher
  • 59
  • 8
1
vote
1 answer

Tracking outgoing requests in Azure Functions

As part of a Microservice based solution that we are building we have a number of Azure Functions sitting in one Azure Function App. The functions Orchestrate numerous requests to different APIs some of which take a long time to complete. We added…
1
vote
3 answers

Beginners Question - Visual C# - System.Net Assembly and WebRequest

Hopefully this is a simple fix I have the code: using System.Net; namespace WebGet { public partial class Web { public static void Main() { WebRequest webRequest; } } } And I get an error saying it…
Greycrow
  • 1,603
  • 5
  • 19
  • 29
1
vote
0 answers

How can I convert raw string to HttpRequestMessage object?

I am writing integration test cases where I need to mock web service. I will have a dictionary that maps requests to fake responses. The IEqualityComparer is suitably overloaded to treat similar requests as same. To populate the…
Jatin Sanghvi
  • 1,928
  • 1
  • 22
  • 33
1
vote
0 answers

'System.InvalidProgramException' in System.Net.Http.dll c#

Tests in my unit test project which are written for WebApi's are failing. The Exception that is thrown is 'System.InvalidProgramException' in System.Net.Http.dll Additional information: Common Language Runtime detected an invalid program. This is…
Vinodh
  • 385
  • 1
  • 4
  • 15
1
vote
2 answers

How can I get HttpHeaders.TryGetValues() to return several values?

I’m using HttpHeaders.TryGetValues but I can’t figure out how to make it return several values. Here is what I’m trying: using System.Net.Http; var response = await new…
0xced
  • 25,219
  • 10
  • 103
  • 255