Skip to content

Specific Win10/11 Proxysettings cause wrong result in WebRequest.DefaultWebProxy.GetProxy(...) #91045

@ole1986

Description

@ole1986

Description

Believe it or not!

I noticed when running .NET 6 Framework on Win10 Build 1905.3324 with VS 2022 17.6.5 it seem to be important that the URL given in the System -> Proxysetting does not contain any "http://" prefixes in the address field.

As long as Proxysetting is stored with "http://", the following code always returns NULL instead of the proxy Uri

WebRequest.DefaultWebProxy.GetProxy("https://google.de")

Reproduction Steps

  1. create a simple console app with WebRequest.DefaultWebProxy.GetProxy("https://google.de") to return
  2. Configure the Win10 System -> Proxysettings to contain "http://" in the address field (E.g. Address: http://proxy.fqdn.local Port: 3128) and keep the proxy exceptions empty
  3. Enable and save the Proxysettings
  4. Run the console app and expect a NULL to be returned from GetProxy(...) method

Expected behavior

WebRequest.DefaultWebProxy.GetProxy("https://google.de") should return the Proxy URL given in the Proxysettings of the system

Actual behavior

WebRequest.DefaultWebProxy.GetProxy("https://google.de") returns NULL

Regression?

I assume it worked on .NET 4.x since I used this framework version before migrating to .NET 6

Known Workarounds

NOW COME THE FUN PART

The workaround to use the very old "Internet option" which is still available in Win10

image

Since, the Proxy configuration from the "Internet options" dialog causes the proxy address to always be stored without "http://" prefix

Configuration

  1. .NET 6
  2. Win10 Build 1905.3324
  3. x64 platform
  4. Visual Studio 2022 17.6.5

Other information

No response

Metadata

Metadata

Assignees

Labels

area-System.Nethelp wanted[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions