When using the "default proxy", where does the username / password come from?

The WebClient class (and ClickOnce also) can use the default proxy settings (for example, put in application.config):

  • Where does the username / password come from? (I do not see the settings in the XML configuration - see below).
  • Is it possible to configure the application manually to request a user for username / password

http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx

<defaultProxy enabled="true|false" useDefaultCredentials="true|false" <bypasslist> … </bypasslist> <proxy> … </proxy> <module> … </module> /> 

PS. I just tested the following setup and confirmed that the username / password is not related to a successful IE session in IE.

An outstanding question, where did the username / password come from? Or should it be software installed in the user application, and in this case, what happens with ClickOnce? (which does not seem to start any dialog so that the user can provide a username / password)

 <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.net> <defaultProxy enabled="true" useDefaultCredentials="false"> <bypasslist> <add address="localhost" /> </bypasslist> <proxy usesystemdefault="True" proxyaddress="http://proxy1.health.qld.gov.au:80/" bypassonlocal="False" /> </defaultProxy> </system.net> </configuration> private void button2_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { var wc = new WebClient(); var str = wc.DownloadString(textBox1.Text); MessageBox.Show("String = " + str); } finally { Cursor.Current = Cursors.Default; } } 
+4
source share
1 answer

Credentials come from your network settings. You can easily install them manually in code, just use the WebProxy class.

 WebProxy proxy = new WebProxy("http://yourproxyserveraddress"); NetworkCredential cred = new NetworkCredential("user","password","domain"); proxy.Credentials = cred; HttpWebRequest.DefaultWebProxy = proxy; 
+2
source

Source: https://habr.com/ru/post/1303626/


All Articles