I am automating a website with HttpWebRequests. The website in question requires Internet Explorer for the web application to work correctly. Because I'm not using a webBrowser control, the web request just returns a page notifying me that I need to be using Internet Explorer. Is there a way to trick the website into thinking that I'm using Internet Explorer, or will I have to use the webBrowser control?
Try to set UserAgent string:
public static void PretendToBeIE(HttpWebRequest request)
{
request.UserAgent = "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)";
}
There is no guarantee that it will work though, everything depends on web app you are using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With