Reputation: 6609
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?
Upvotes: 3
Views: 3795
Reputation: 34447
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.
Upvotes: 2