Hello I'm having a small problem, I have a listbox with a websites in that need checking. To check the sites I open the follwing url and it will return either 0, 1 or -1:
Where the text saying "item" is, that is the item in the listbox. My code needs to loop through every item checking them. So far I'v tried this:Code:http://www.mysite.com/check.php?id=item
The problem with this is, even though it has the user and password in for the .htaccess protection, it still doesn't let me download the string and says unortharised access.Code:Public Sub RemoveSites(ByVal Lst As ListBox, ByVal ListName As String) Dim Client As New System.Net.WebClient For Each Item In Lst.Items 'Downloads the source Dim Html As String = Client.DownloadString("http://username:[email protected]/check.php?id=" & GetSiteName(Item)) 'Checks If Html = "1" Then 'Need to remove Lst.Items.Remove(Item) ElseIf Html = "-1" Then 'Need to remove Lst.Items.Remove(Item) End If Next End Sub
I know you can login like:
http://username:[email protected]/check.php?id=
So thats why I tried above.
Another way I tried was to use a web browser, this seems to work as far as the site opening with out the unortharised access. But it doesn't download the content so cant' check.
The above code doesn't work because they all get the message box saying "Nothing :(", some of them should return 1 or -1 because I'v checked.Code:Public Sub RemoveSuspendedFast(ByVal Lst As ListBox, ByVal ListName As String) 'For each item check if suspended For Each Item In Lst.Items 'Open the page wbSuspend.Navigate(New Uri("http://username:[email protected]/check.php?id=" & GetSiteName(Item))) 'Read the page If wbSuspend.DocumentText = "1" Then 'Has been suspended - remove. Lst.Items.Add(Item) ElseIf wbSuspend.DocumentText = "-1" Then 'Doens't exist - remove. Lst.Items.Add(Item) Else MsgBox("Nothing :(") End If Next End Sub
Is there anyway I can open a site that is password protected by .htaccess and download the content of it for checking.




Reply With Quote