Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I set the default proxy to use default credentials?

Tags:

.net

proxy

The following code works for me:

var webProxy = WebProxy.GetDefaultProxy(); webProxy.UseDefaultCredentials = true; WebRequest.DefaultWebProxy = webProxy; 

Unfortunately, WebProxy.GetDefaultProxy() is deprecated. What else should I be doing?

(using app.config to set the defaultProxy settings is not allowed in my deployment)

like image 845
Brian Genisio Avatar asked Nov 18 '08 20:11

Brian Genisio


People also ask

How do I change proxy credentials?

Setting up the credentials for the Proxy Server: In Windows 10 menu, go to Settings (WinKey+I) and search for "Credential Manager". Under Windows Credentials, add a new entry for Windows Credentials. Enter the Proxy Server address (without the port number), your domain user name and the password.

How do I change proxy settings in Windows 10?

Select the Start button, then select Settings > Network & Internet > VPN. Select the VPN connection, then select Advanced options. Under VPN proxy settings, select the type of proxy setup you want to use, then enter the proxy server information for that VPN connection.


1 Answers

For those who, unlike Brian Genisio, are able to set the contents of their application's config file:- don't do anything in code. Instead add this to your app.config / web.config.

<system.net>   <defaultProxy useDefaultCredentials="true" /> </system.net> 

Really and truly the default for using the default credentials should be "true"; I've seen this issue confuse so many people - developers, users, IT guys.

For more info see here:- http://sticklebackplastic.com/post/2007/01/26/Poxy-proxies.aspx

UPDATE: I've created this issue/idea for Microsoft to change the default of useDefaultCredentials from false to true so that this whole problem goes away and .NET apps "just work"; please vote it up if you agree:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2397357-fix-it-so-that-net-apps-can-access-http-thru-auth

like image 139
Bellarmine Head Avatar answered Nov 02 '22 03:11

Bellarmine Head