Ok i have this code to download some data

Private Sub Getfiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Getfiles.Click
        Webbrowser.Navigate(New System.Uri("http://mail.google.com/mail/feed/atom"))
        Dim Net As New System.Net.WebClient
        AtomFeed = System.Text.Encoding.ASCII.GetString(Net.DownloadData("http://mail.google.com/mail/feed/atom"))
        Atomfeedtext.Text = AtomFeed
    End Sub

Every Time i run it i get a 401 Unauthorised Error

I believe this because the web browser has logged in but the net has not, so can i make the net interact with the web browser to give me the authorisation or should i make it log on to both

Heres my Web Browser login script

Dim Document As Object
        If Login.Text = "Login" Then
            On Error Resume Next
            Document = Webbrowser.Document.DomDocument

            Document.Forms(0).email.Value = User.Text
            Document.Forms(0).passwd.Value = Pass.Text

            Login.Text = "Logout"
            Getfiles.Enabled = True
            Webbrowser.Navigate(New System.Uri("http://mail.google.com/mail/?logout&hl=en"))
            Login.Text = "Login"
            Getfiles.Enabled = False
        End If

oh and heres the atomfeed Dim if you want it

Dim AtomFeed As Object

Thanks for your help

11 Years
Discussion Span
Last Post by Sacky

I was thinking of using some sort of HTTP screen scraping for this instead, does anyone know any tutorials to start me off?


That worked thanks :)
But now ive got another problem

Heres the code:

Private Sub WebBrowser_DocumentCompleted(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs, ByVal pDisp As Object) Handles Webbrowser.DocumentCompleted
        Dim URL As String = eventArgs.Url.ToString()
        Dim i As Object
        If Webbrowser.Url.ToString() = "http://mail.google.com/mail/feed/atom" Then
            On Error Resume Next
            If (pDisp Is Webbrowser.Object) Then
                html.Text = ""
                For i = 0 To 520
                    If (VB.Left(Webbrowser.Document.DomDocument.All(i).innerHTML, 7)) = "GMAILFS" Then
                        html.Text = html.Text & Webbrowser.Document.DomDocument.All(i).innerHTML & vbNewLine
                        html.Text = html.Text & Webbrowser.Document.DomDocument.All(i + 21).innerHTML & vbNewLine & vbNewLine
                        FilesList.Items.Add(Mid(Webbrowser.Document.DomDocument.All(i + 21).innerHTML, 68 + Len(Atomfeedtext.Text), 16))
                    End If
            End If
        End If
    End Sub
End Class

My two errors are:


Method 'Private Sub WebBrowser_DocumentCompleted(eventSender As Object, eventArgs As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs, pDisp As Object)' cannot handle Event 'Public Event DocumentCompleted(sender As Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)' because they do not have the same signature


If (pDisp Is Webbrowser.Object) Then

'Object' is not a member of 'System.Windows.Forms.WebBrowser'.

Are there any suggestions?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.