how to set the http headers when sending http request to a server so that the server thinks the requests are coming from firefox

StackOverflow https://stackoverflow.com/questions/1811744

Question

how to set the http headers when sending http request to a server so that the server thinks the requests are coming from firefox

Was it helpful?

Solution

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
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top