Revision: 15257
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 29, 2009 14:49 by wraith808
Initial Code
var result = new StringBuilder(); try { var transferProxy = new WebProxy("<webproxy>:<proxyport>/", true); transferProxy.Credentials = new NetworkCredential("<username>", "<password>", "<domain>"); var transferRequest = WebRequest.Create("http://www.snipplr.com"); transferRequest.Proxy = transferProxy; HttpWebResponse transferResponse = (HttpWebResponse)transferRequest.GetResponse(); System.IO.Stream outputStream = transferResponse.GetResponseStream(); System.Text.Encoding outputEncoding = System.Text.Encoding.GetEncoding("utf-8"); System.IO.StreamReader outputReader = new System.IO.StreamReader(outputStream, outputEncoding); char[] chars = new Char[256]; int readCount = outputReader.Read(chars, 0, 256); int totalRead = readCount; while(readCount > 0) { string str = new String(chars, 0, 256); result.Append(str); readCount = outputReader.Read(chars, 0, 256); } transferResponse.Close(); outputStream.Close(); outputReader.Close(); } catch(Exception ex) { string str = ex.Message; } StreamWriter fileOut = new StreamWriter("testProxy.txt"); fileOut.WriteLine(result.ToString()); fileOut.Close();
Initial URL
Initial Description
Initial Title
Example Web Proxy Use
Initial Tags
Initial Language
C#