how to set the http headers when sending http request to a server so that the server thinks the requests are coming from firefox
views:
61answers:
1
+1
A:
One needs to alter the HTTP Header's User-Agent value, to something that looks like the following:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
In C#/ASP.NET (assuming this is follow-up on previous question)
using (WebClient myBrowser= new WebClient())
{
myBrowser.Headers["User-Agent"] = some_string_like_the_one_above;
// Download data.
byte[] httpResp = myBrowser.DownloadData(some_url);
// Here to exploit the data returned from the server
}
mjv
2009-11-28 06:13:47
in your answer what is mybrowser variable
2009-11-28 06:20:52
@Anirudha myBrowser is an instance of `WebClient` which is an object .NET supplies to create a virtual web browser which runs within one's program. I named it "myBrowser" because essentially it would be like a browser within the program, but it could be named anything else (? say webclt_one or whatever)
mjv
2009-11-28 06:34:55
ok very very thanks
2009-11-28 06:39:43