Is WebProxy class only support HTTP proxy type?
Is there a way to use Socks4, Socks4a or Socks5 proxy types with WebProxy class.
I have downloaded a Proxy Server "ccproxy" from
http://www.youngzsoft.net/ccproxy/screenshot.htm
where i can use my code to download and upload files but it works only with Port 808 reserved for HTTP proxy in ccproxy server.
Http Get Code...
WebClient client = new WebClient();
if (tbpassword.Text != "" && tbUsername.Text != "")
{
NetworkCredential auth = new NetworkCredential(tbUsername.Text, tbpassword.Text);
client.Credentials = auth;
}
if (tbProxyAddress.Text != "" && tbProxyPort.Text != "")
{
WebProxy proxy = new WebProxy(tbProxyAddress.Text, Convert.ToInt32(tbProxyPort.Text));
if(tbProxyUsr.Text != "" && tbProxyPwd.Text != "")
proxy.Credentials = new NetworkCredential(tbProxyUsr.Text, tbProxyPwd.Text);
client.Proxy = proxy;
}
Uri uri = new Uri(tbURL.Text);
client.DownloadFile(uri, tblocalFile.Text);
client.Dispose();
HTTP Post Code...
WebClient client = new WebClient();
if (tbpassword.Text != "" && tbUsername.Text != "")
{
NetworkCredential auth = new NetworkCredential(tbUsername.Text, tbpassword.Text);
client.Credentials = auth;
}
if (tbProxyAddress.Text != "" && tbProxyPort.Text != "")
{
WebProxy proxy = new WebProxy(tbProxyAddress.Text, Convert.ToInt32(tbProxyPort.Text));
if (tbProxyUsr.Text != "" && tbProxyPwd.Text != "")
proxy.Credentials = new NetworkCredential(tbProxyUsr.Text, tbProxyPwd.Text);
client.Proxy = proxy;
}
Uri uri = new Uri(tbURL.Text);
System.Collections.Specialized.NameValueCollection collect = new System.Collections.Specialized.NameValueCollection();
collect.Add("input", "Ronak");
collect.Add("submit", "Submit");
byte[] btArray = client.UploadValues(uri, "POST", collect);
//byte[] btArray = client.UploadFile(uri, "POST", tblocalFile.Text);
MessageBox.Show(Encoding.UTF8.GetString(btArray));
client.Dispose();