Save the configuration-derived policy before the application first replaces WebRequest.DefaultWebProxy:

System.Net.IWebProxy configuredPolicy =
    System.Net.WebRequest.DefaultWebProxy;

Restore that reference at the controlled application boundary:

System.Net.WebRequest.DefaultWebProxy = configuredPolicy;

An IWebProxy can select different routes and bypasses for different destinations. Resolving one test URL and building a fixed WebProxy from the answer loses those decisions.

DefaultProxySection is configuration data, not a public conversion interface for recreating the Framework's effective policy. Its internal conversion code is not an application API.

The saved value is an object reference, not a deep copy. If the application mutates that object's credentials or settings, assigning the reference back cannot undo those mutations.

For a single request or separate workload, configure its client directly. Temporarily switching this shared default around concurrent work gives other callers the same changing policy.

Artihkkalat mat laktásit