Is there a way to access web pages without WebBrowser?
Say for instance I wanted to access a website, do a search, and pull the results into my application.
Is there another component, or something, I could use to gain access to that site?
Thanks for your help.
(.NET) Browsing the web w/o WebBrowser
Started by scheda, Apr 06 2010 12:45 PM
4 replies to this topic
#1
Posted 06 April 2010 - 12:45 PM
|
|
|
#2
Posted 07 April 2010 - 10:21 AM
You could read the webpage into a string and then parse it with RegEx. You'd be better doing this with some sort of XML or json feed if the site you want to read has one.
#3
Posted 07 April 2010 - 11:37 AM
you can use:
Dim mywebclient as new Net.Webclient
Dim content as String = mywebclient.downloadstring("the url")
#4
Posted 07 April 2010 - 02:02 PM
Vswe said:
you can use:
Dim mywebclient as new Net.Webclient
Dim content as String = mywebclient.downloadstring("the url")Csharpification:
WebClient client = new WebClient();
string foo = client.DownloadString("http://www.website.com/file.txt");
Also, try DownloadStringAsync if you're multithreading (best when downloading large files).
Edited by semprance, 07 April 2010 - 02:03 PM.
Extra CODE tag snuck in...
#5
Posted 07 April 2010 - 02:49 PM
oops, misread the section it was posted in, thought it was VB. But yeah that is the C# version.


Sign In
Create Account

Back to top









