.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
HttpWebRequest in .NET Framework cannot provide a Microsoft-supported guarantee of at most one HTTP transmission per GetResponse() call; design the operation as idempotent or add server-side deduplication when duplicates must have no additional effect.
What can happen in .NET Framework 4.8
One synchronous call to GetResponse() can result in more than one network transmission.
The published .NET Framework Reference Source contains an internal resubmission path for:
-
WebExceptionStatus.KeepAliveFailure -
WebExceptionStatus.PipelineFailure
On the synchronous path, the implementation sets m_Retry = true, allowing GetResponse() processing to submit the request again. The asynchronous path can call the submission routine again directly. Therefore, a connection that fails while being reused—or a pipeline failure—can cause a transparent resend inside the same application-level operation ^1^.
This establishes that retransmission logic exists, but it does not establish that every transient network error is retried. The available public documentation does not provide an exhaustive, version-pinned table of all retry branches in the particular System.dll build installed on your computer.
Also, m_Retry is implementation state, not a public contract. Microsoft explicitly warns that internal HttpWebRequest fields are unsupported for production use; for example, _AutoRedirects is documented as internal and unsupported ^2^. Reflection against m_Retry, patching it, or relying on its initial value would therefore not be a supported control.
Effect of the properties you listed
These settings suppress particular protocol behaviors, but not every possible resubmission path:
-
AllowAutoRedirect = falseprevents automatic following of HTTP 3xx responses. The 3xx response is returned to the application instead ^3^. It does not represent a general retry switch. -
KeepAlive = falserequests a nonpersistent connection rather than a persistent one ^4^. This should avoid the ordinary stale reused-connection scenario associated withKeepAliveFailure, but the documentation does not define it as disabling every internal retransmission. -
PreAuthenticate = falsecontrols whether authentication information is sent preemptively after prior authentication. It is not a retry control ^5^. -
Credentials = nullwith an explicit Bearer [Token] avoids credential-based authentication modules for the request. It does not create an at-most-once transport guarantee. - Timeouts bound waiting time.
GetResponse()can throwWebExceptionon timeout or another processing error, but an exception cannot establish that no bytes reached the server ^6^.
Consequently, your combination of settings reduces redirect, connection-reuse, and challenge-authentication traffic, but it does not form a documented “single transmission” mode.
Why transport-level at-most-once is not enough
A client can transmit a complete request and then lose the response because the connection resets or times out. From the client’s perspective, that state is ambiguous: the server might not have received the request, or it might have received and processed it successfully.
Microsoft’s retry guidance describes this exact boundary: a service can process a request successfully but fail to return the response, after which a resend can execute the operation again ^7^. Preventing a client-library retry would not remove ambiguity caused by failures elsewhere, including proxies, gateways, or server-side components.
For your stated operation, HTTP GET is defined as safe and idempotent: processing the same GET multiple times should not change resource state ^8^. If this particular endpoint gives GET a side effect, it does not conform to those semantics and should be redesigned.
For operations where duplicate processing matters:
- Assign each logical operation a unique immutable identifier.
- Send it as an idempotency key or operation ID.
- Persist that key atomically on the server.
- Return the stored result when the same key appears again instead of repeating the side effect.
This provides effectively-once processing despite uncertain delivery; eliminating duplicate delivery across a distributed system is generally impractical ^9^.
Client choice
Microsoft recommends migrating new development from HttpWebRequest to HttpClient because the former is obsolete ^10^. That migration is appropriate for maintainability and explicit handler configuration, but the supplied documentation does not establish that HttpClient on Windows PowerShell 5.1 guarantees one physical transmission either.
If proof of the behavior of your exact patched runtime is required, capture both sides of a controlled test:
- Client-side packet trace.
- Server access/application log containing a unique correlation ID.
- Injected stale keep-alive connections, resets, and response loss.
- Exact
System.dllfile version and hash recorded with the results.
Such testing can characterize that build under tested failures, but it cannot turn an internal implementation detail into a supported contractual guarantee.
References
- referencesource/System/net/System/Net/HttpWebRequest.cs at main · microsoft/referencesource · GitHub
- HttpWebRequest._AutoRedirects Field
- HttpWebRequest.AllowAutoRedirect Property-Definition
- HttpWebRequest.KeepAlive Property-Definition
- HttpWebRequest.PreAuthenticate Property-Definition
- HttpWebRequest.GetResponse Method-Definition
- Retry pattern
- HTTP support in .NET
- Idempotent Consumer pattern
- HttpWebRequest to HttpClient migration guide