Solved

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

Posted on 2010-09-13
4
404 Views
Last Modified: 2012-05-10
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
Comment
Question by:CompGenHosp
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Amandeep Singh Bhullar earned 500 total points
ID: 33663742
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
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 33664060
0
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 33664102
0
 

Author Closing Comment

by:CompGenHosp
ID: 33694653
After more recearh found that the aspx page can't be sent in the emial.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about why website design really matters in today's demanding market.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question