-1

I am working on WPF application and need to test some server requests with a proxy. I can't find anyone for free with username and password. Does anyone have an idea or can give me a guide?

1 Answer 1

0

Use this code . this code helps you to enter username or password to credentials if the Http Proxy needs it :

string PROXY = "199.21.97.75:80"; //TYPE OF PROXY : HTTP
string WEBSITE = "http://www.google.com";
string USERNAME = "";
string PASSOWRD = "";
bool CREDENTIALS; //if Proxy needs it
HttpWebRequest HTTP = (HttpWebRequest)HttpWebRequest.Create(WEBSITE);
HTTP.Proxy = new WebProxy(PROXY);
if (CREDENTIALS == true)
{
HTTP.Proxy.Credentials = new NetworkCredential(USERNAME, PASSOWRD);
}
else
{
HTTP.Proxy.Credentials = CredentialCache.DefaultCredentials;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.