0

I am writing a C# application whereby I formulate the POST strings in C# but the website I am POSTing recognizes that I am not using IE, Chrome or Firefox. Is there a way that I can "use" Internet Explorer (or either of the other two browsers) to make the POST request and then retrieve the response back in the C# (to parse the HTML)?

I have this currently:

using (var wb = new WebClient())
{
    var data = new NameValueCollection();
    //Any key-value arguments for the POST are stored in data
    var response = wb.UploadValues(url, "POST", data);
}
user997112
  • 29,025
  • 43
  • 182
  • 361

2 Answers2

1

Yes. Forge the User-Agent HTTP header. The User-Agent header basically tells the receiving server what program is sending the packets to it.

See this StackOverflow answer on how to do just that.

Community
  • 1
  • 1
eshs
  • 194
  • 7
0
    client.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";

place after response

also

Other Response

Community
  • 1
  • 1