HttpWebRequest Nesnesi ile Proxy Kullanmak veya kullanmamak
28 Ekim 2008 SalıPosted by
Volkan
0 Comments
HttpWebRequest, bu nesne yi web browser olarak kullaniyorsaniz şöyle bir sorunla karşılaşabilirsiniz.
1. internet explorer (ie) Lan Settings ayarlarinda degisiklik yapildiginda browser etkilenebilir.
2. Siz HttpWebRequest ile webbrowser da proxy yapmak isteyebilirsiniz.
string UrlAddress = "http://volkanaltan.com"
Uri ourUri = new Uri(UrlAddress);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ourUri);
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0;Windows NT 5.1; .NET CLR 1.1.4322)";
request.ContentType = "text/html;charset=ISO-8859-1";
request.AllowAutoRedirect = true;//yonlendirmeye izin ver
request.Proxy = null; //Lan Settings degismisse sen bundan etkilenme
Proxy yapmak için;
WebProxy proxy = new WebProxy('127.0.0.1',80);
request.Proxy = proxy