Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   WebRequest and WebResponse has issues (http://www.go4expert.com/forums/webrequest-webresponse-issues-t29225/)

Complete 25Oct2012 22:54

WebRequest and WebResponse has issues
 
WebRequest and WebResponse has issues

I wrote a C# program that uses WebRequest and WebResponse to perform a simple web crawler. I discovered something about web sites. Web browsers such as IE and FireFox offer the capacity to view the HTML source code. But it seems that html code that is sent to the browser is one thing and what the browser interprets and displays is something else. For example, if you run a google search in IE and run the same google search in FireFox, the content that you can see when you view the source in IE will NOT have the hyperlinks and content from the search results, but you can see the html hyperlinks and content from the search results when you view the source in FireFox. So my question is this. How do you specialise the WebRequest and WebResponse to show the content after it is processed by the browser instead of before?

One possible solution might be to use HttpWebRequest instead of WebRequest and use the UserAgent property to somehow trick C# into thinking I am using the Firefox browser. But this does not seem to me to plausable.

I also tried the WebBroswer control without setting it to visible, but I don't know the syntax to use.

The examples I have found seem to suggest that before I use the WebBrowser class it is required to assign it to a URL. Following that< can set the visitiblity to hidden. But wouldn't it be too late then?

The "Navagate" method does not seem to offer the capacity to load a URL hidden.

http://msdn.microsoft.com/en-us/libr....navigate.aspx


All times are GMT +5.5. The time now is 04:38.