Hey I am working on a proxy testing program as a personal project for a friend of mine, and for the life of me I cannot figure it out. I have searched the forums and MSDN till im blue in the face for something I figured would be very simple. maybe you can help, all I need to do is do a HTTP-GET to a specified URL ( his website ) through a third party proxy ( my proxy ) from c# application. Can anyone point me in the right direction

HTTP-GET through a proxy
LuisCabrera
WebProxy wp = new WebProxy("<my proxy server", true);
wp.UseDefaultCredentials = true // OR
wp.Credentials = new NetworkCredential(pass the user domain and password)//Set the proxy
Req.Proxy = wp;
Fat Controller
proxy.Credentials = CredentialCache.DefaultCredentials
Russ555
using
System;using
System.Net;using
System.IO;using
System.Collections.Generic;using
System.Text;namespace
ConsoleApplication1{
class Program{
static void Main(string[] args){
HttpWebResponse Res = null; Stream s = null; try{
HttpWebRequest Req = WebRequest.Create("http://www.microsoft.com") as HttpWebRequest; //WebProxy wp = new WebProxy("<my proxy server", true); //Req.Proxy = wp;Res = Req.GetResponse()
as HttpWebResponse;s = Res.GetResponseStream();
StreamReader sr = new StreamReader(s); Console.WriteLine(sr.ReadToEnd());sr.Close();
}
catch (Exception ex){
Console.WriteLine(ex);}
finally{
if (Res != null) Res.Close(); if( s != null) s.Close();}
}
}
}
ChipDowns
Also, if you don't want to set your proxy per request, you can set it for all requests via an application configuration file in V2.0:
<configuration> Element
system.Net Element (Network Settings)
defaultProxy Element (Network Settings)
proxy Element (Network Settings)
Suj
How would this code need to be modified to pass the credentials to the proxy server
Any help would be appreciated.
Paul
cparsons
However, I was surprized that the .UseDefaultCredentials method was not available to me. Perhaps I was initializing something incorrectly.
Thanks, again.