copying html contents from file with querystring

Hello

i need to copy the contents of a html file. i have tried the DownloadString method, but

the page i need to copy has a querystring. (e.g articles.aspx id=2) if i add the querystring to the address then an error pops up saying the address is not a valid virtual path.

Any ideas how i can get around it



Answer this question

copying html contents from file with querystring

  • Jake.K

    thank you for the help, much appreciated. I will post again if there is anything more, but for now its sorted.


  • B.Huard

    I took part in a discussion simular to this that might work for you. We solved it using the WebBrowser control like this:

    Imports System.IO

    Public Class Form1

    Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click

    'get bank website

    Dim oUri As New Uri(urlTextbox.Text, False)

    Me.WebBrowser1.Url = oUri

    'after i'm there, log in manually and find a page to save

    End Sub

    Public Function GetPageHTML(ByVal URL As String) As String

    ' Retrieves the HTML from the specified URL

    Dim objWC As New System.Net.WebClient()

    Return New System.Text.UTF8Encoding().GetString( _

    objWC.DownloadData(URL))

    End Function

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

    MessageBox.Show(GetPageHTML(Me.WebBrowser1.Url.ToString))

    End Sub

    End Class

    Check out http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1134712&SiteID=1 and let me know if that works out for you



  • copying html contents from file with querystring