Link to home
Start Free TrialLog in
Avatar of CompGenHosp
CompGenHosp

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of Amandeep Singh Bhullar
Amandeep Singh Bhullar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CompGenHosp
CompGenHosp

ASKER

After more recearh found that the aspx page can't be sent in the emial.