Read HTML file in asp.net VB

 Protected Sub LoadStatement()

        Try
            'Open a file for reading
            Dim FILENAME As String = Server.MapPath("agreement.htm")

            'Get a StreamReader class that can be used to read the file
            Dim objStreamReader As StreamReader
            objStreamReader = File.OpenText(FILENAME)

            'Now, read the entire file into a string
            Dim contents As String = objStreamReader.ReadToEnd()
            objStreamReader.Close()
            contents = contents.Replace("<br /><br />", vbCrLf)
            contents = contents.Replace("<br />", vbCrLf)
            contents = RemoveHTML(contents)
            Dim strAgreement As String
            strAgreement = "Independent Contractor Agreement" & vbCrLf & vbCrLf & contents

            txtAgreement.Text = strAgreement
        Catch ex As Exception

        End Try

Click here to see code in C#

Related Alrticles

Add Your Business in Free Listing


FREE!!! Registration