Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 411
  • Last Modified:

Send a web page (aspx) in the email vb.net

I want to send a content of the web page in the email. I’m getting: “The remote server returned an error: (401) Unauthorized.” error.

Please help.

I use the following the following code:


Dim url As String = "http://sf3876IS/ZZZ/xxxxx.aspx?JETNum=" & JETNum & "&PrID=" & vPrID & "&CurID=" & vCurID & ""
Email.Body = HttpContent(url) & vBODY

   Private Function HttpContent(ByVal url As String) As String

            Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(url)
            objRequest.Credentials = New NetworkCredential("username", "password")
            Dim sr As New StreamReader(objRequest.GetResponse().GetResponseStream())
            Dim result As String = sr.ReadToEnd()
            sr.Close()
            Return result

 End Function

Open in new window

0
CompGenHosp
Asked:
CompGenHosp
  • 2
1 Solution
 
Amandeep Singh BhullarCommented:
You cannot send the aspx page in a e-mail.
All you need to do is to send the part of the page in the form of HTML.
This will solve your issue
0
 
CompGenHospAuthor Commented:
After more recearh found that the aspx page can't be sent in the emial.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now