Posted on: 7/30/2012 9:16:12 PM | Views : 1217

I am currently trying to write a scraper to run through my website and create a collective list removing the HTML tags. I have written what I thought to be a simple loop, but it is throwing this error when ran:
Must be non-negative and less than the size of the collection.
Parameter name: startIndex
Here is the code:
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit Dim client As WebClient = New WebClient() Dim pageToSearch As String Dim indexStart As Integer Dim indexEnd As Integer Dim tool As String Dim count As Integer = 0 Dim length As Integer pageToSearch = client.DownloadString("abc123.com") While count < pageToSearch.Length indexStart = pageToSearch.IndexOf("<a style=""margin-right:1em""", count) indexEnd = pageToSearch.IndexOf("</a>", ...

Go to the complete details ...