sorry ,i am chinese.English is very poor .
i see fiddler web debug have a function named "HOSTS",it in catalog "tools->HOSTS",
now i use fiddlercore,but i donot find the HOSTS function .
i found a class named HostList,but I don't know how to use it.
i want modify request host's ip address.
for example :
private void onBeforeRequest(Fiddler.Session oSession)
{
//now oSession.host = "5158.s20.javaidc.com";ip is 118.26.135.190,i want modiyf to 127.0.0.1 ,but the request head remain the same
// under code is not working, I don't know whether or not write code in beforeRequest or other place
oSession.m_hostIP = "127.0.0.1";
//under code is modefiy request head
//oSession.host = "127.0.0.1";
}
thank you make the fiddler software. Help me to solve a lot of trouble.
public static string RequestHttp(string url, string referer, ref CookieContainer cookieContainer_0, IWebProxy proxy) { string str = string.Empty; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; request.UserAgent = randomuseragent(); request.ContentType = "application/x-www-form-urlencoded"; request.Accept = "*/*"; request.CookieContainer = cookieContainer_0; request.Proxy = proxy; request.Timeout = 15000; request.Referer = referer; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (Stream responseStream = response.GetResponseStream()) { List<byte> list = new List<byte>(); byte[] buffer = new byte[0x400]; int count = responseStream.Read(buffer, 0, buffer.Length); while (count != 0) { list.AddRange(buffer.ToList<byte>().GetRange(0, count)); if (list.Count >= 0x100000) { break; } count = 0; try { HERE IT HANGS SOMETIMES ---> count = responseStream.Read(buffer, 0, buffer.Length); continue; } catch { continue; } } int num2 = 0x200 * 0x400; if (list.Count >= num2) { list.RemoveRange((num2 * 3) / 10, list.Count - num2); } byte[] bytes = list.ToArray(); str = Encoding.Default.GetString(bytes); Encoding encoding = Encoding.Default; if (str.ToLower().IndexOf("charset=") > 0) { encoding = GetEncoding(str); } else { try { encoding = Encoding.GetEncoding(response.CharacterSet); } catch { } } str = encoding.GetString(bytes); } } return str.Trim(); }