Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 6th, 2006, 06:47 AM
Registered User
 
Join Date: Jun 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mykhan
Default Emailing the contents of an aspx page

Hi all!

 I have a problem emailing the whole contents of a page to a specified e-mail address, using HttpWebRequest Class' object. Following is what I am doing:

Public Sub mailthispage()

Dim html As String = catchHtml("http://localhost:8080/myfile.aspx?did=240&type=mail")
Dim email As New System.Net.Mail.MailMessage()
email.From = New System.Net.Mail.MailAddress("mykhan@mydomain.com")
email.To.Add("mykhan@mydomain.com")
email.Subject = "This page is emailed"
mail.Body = html
mail.IsBodyHtml = True
Dim smtp As New System.Net.Mail.SmtpClient("127.0.0.1")
smtp.Send(email)
End Sub


Public Function catchHtml(ByVal URL As String) As String

Dim reg As WebRequest
req= New System.Net.HttpWebRequest.Create(url)
Dim Stream As New StreamReader(req.GetResponse().GetResponseStream() )
Dim result As String = Stream.ReadToEnd()
Stream.Close()
Return result
End Function


I am calling mailthispage() at load if the querystring's type value is e-mail. Now this is giving error, The remote server returned an error: (401) Unauthorized.

Can anyone guide me solve this?

 regards

Mykhan


Life is a quest and Love is a Quarrel
 
Old December 6th, 2006, 09:21 AM
Registered User
 
Join Date: Jun 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mykhan
Default

Just to add some more, the above error comes, when i use my local server, I mean localhost, when I try the same on my domain, it gives a timeout error and hangs the whole domain :(

If anyone have a good solution or suggestion, am waiting anxiously for them

Thanx in advance

Life is a quest and Love is a Quarrel
 
Old December 7th, 2006, 05:05 AM
Registered User
 
Join Date: Jun 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mykhan
Default

I got the problem solved, thanks for your help ;)

Life is a quest and Love is a Quarrel
 
Old December 15th, 2006, 03:41 AM
Authorized User
 
Join Date: Nov 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to akhilhp
Default

How did u solve it? I am also stuck... Please reply!!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
display contents from aspx in IE thas123 ASP.NET 2.0 Basics 0 March 25th, 2007 02:54 AM
Emailing current page toma12 ASP.NET 2.0 Professional 1 November 29th, 2006 12:31 PM
How to protect the contents of web page Aaronmeng ASP.NET 2.0 Basics 0 October 24th, 2006 08:55 PM
clear the contents of controls on a page madhavigujja ASP.NET 1.0 and 1.1 Basics 2 April 20th, 2006 01:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.