.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
Hello @Cinthia Franco , and thank you for your question.
In .NET Framework 4.8, a single application-level call to GetResponse() does not necessarily correspond to exactly one HTTP request being transmitted, as HttpWebRequest can resend a request internally in some situations.
Regarding your questions:
- On whether a GET can be retransmitted internally, and under what conditions: yes, it can. The Reference Source shows resubmission paths for cases such as a reused (keep-alive) connection failing, or a pipelining failure. However, Microsoft does not publish a complete list of the conditions under which this can happen, so I can't confirm that these are the only cases.
- On whether
AllowAutoRedirect=false,KeepAlive=false,PreAuthenticate=falseandCredentials=nullprevent internal retries: these reduce some of those scenarios. For example, KeepAlive=false avoids reusing a persistent connection, and AllowAutoRedirect=false stops 3xx responses from being followed. But none of these settings is documented as disabling internal retransmission altogether. - On whether there is a supported setting or way to guarantee at most one transmission: not that I'm aware of. HttpWebRequest has no documented property or configuration that provides this guarantee.
As for whether the Reference Source matches your installed System.dll, you can check this directly. Running [System.Net.HttpWebRequest].Assembly.Location in your PowerShell 5.1 session shows which System.dll is loaded. You can then inspect HttpWebRequest in that assembly using Visual Studio's built-in decompilation, or Ildasm.exe if you prefer to view the IL (since Ildasm doesn't work on files in the global assembly cache, copy the DLL to a separate folder first), and compare the retry-related logic, such as m_Retry, with the source. This shows how your current build is implemented, but it is not a supported guarantee and may change with future updates.
If you need to avoid duplicate requests, it is more reliable to handle this on the application or server side, for example by sending a unique request identifier and having the server detect repeats. This also covers the case where the server received the request but the response was lost, which the client alone cannot distinguish from a request that never arrived.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation. Thank you.