How to scrape an entire web page

Discussion in 'ASP.NET / ASP.NET Core' started by nature, Apr 7, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. How can I use MSXML to scrape an entire web page and then insert that into the body of an email using asp.net?
     
  2. I think the following will probably give you what you need:

    <%@ Import Namespace="System.Net" %>
    <%@ Import Namespace="System.IO" %>

    <script language="VB" runat="server">

    sub ScrapeANdSendPage()

    dim URL2Scrape As String = "http://www.blahblah.blah"

    dim objWebClient as New WebClient()
    dim objUTF8 as New UTF8Encoding()
    dim intStartObits As Integer
    dim intEndObits As Integer
    dim msg As String

    try
    msg = objUTF8.GetString(objWebClient.DownloadData(URL2Scrape))
    catch
    '-- error code here
    end try

    mailMessage.From = "from address here....."
    mailMessage.To = "to address here....."
    mailMessage.Subject = "subject here....."
    mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html
    mailMessage.Body = msg
    System.Web.Mail.SmtpMail.SmtpServer = "smtp server....."
    System.Web.Mail.SmtpMail.Send(mailMessage)

    end sub

    </script>
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page