Add scheme to URL if needed

后端 未结 5 1924
耶瑟儿~
耶瑟儿~ 2020-12-08 08:49

To create a Uri from a string you can do this:

Uri u = new Uri(\"example.com\");

But the problem is if the string (like the one above) does

5条回答
  •  臣服心动
    2020-12-08 09:48

    Interestingly, although Uri and UriBuilder completely mangle any url without a scheme, WebProxy does it right.

    So just call:

    new WebProxy(proxy.ProxyServer).Address
    

提交回复
热议问题