ILovephp123 ILovephp123 - 2 months ago 14
C# Question

WebProxy URI is not valid

This is the code I currently have

using (WebClient client = new WebClient()) {
WebProxy proxy = new WebProxy();
proxy.Address = new Uri(;
proxy.Credentials = new NetworkCredential(proxyUsername.Text, proxyPassword.Text);
proxy.UseDefaultCredentials = false;
proxy.BypassProxyOnLocal = false;

The proxy needs credentials.

I get an error on line
proxy.Address = new Uri(;


"The URI scheme is not valid."

Not sure what kind of value it's expecting


The Uri should consist of scheme host and optiona port. So you should use

proxy.Address = new Uri("");