Solved

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

Posted on 2010-09-13
4
405 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Razor DropDownListFor - clear selected in SelectList before creation 3 24
Designing forms 3 19
ASP.NET MVC - Views 3 22
asp.net mvc 2 25
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

828 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