473,508 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mailing Webpage in ASP.NET

40 New Member
Hi
I am trying to mail a web page in ASP.NET but failed. Here's my code:

Try
Dim mymail As New MailMessage()
Dim mailcontenturl As String = "http://localhost:9000/dg/WebForm1.aspx"
mymail.From = "ashima515@yahoo.com"
mymail.To = "it.ashima@gmail.com"
mymail.Subject = "test"
mymail.BodyFormat = MailFormat.Html
mymail.Body = getHTML(mailcontenturl)
mymail.Priority = MailPriority.High
mymail.UrlContentBase = mailcontenturl
SmtpMail.Send(mymail)
Response.Write("mail sent")

Catch
Dim ex As New System.Net.WebException()
Response.Write(ex.Message)

End Try



End Sub

Private Function getHTML(ByVal url As String) As String

Dim wreq As WebRequest = System.Net.HttpWebRequest.Create(url)
Dim wres As WebResponse = wreq.GetResponse
Dim value As Boolean = False
Dim sr As New StreamReader(wres.GetResponseStream())
Dim result As String = sr.ReadToEnd
wreq.Timeout = 100000
wreq.Credentials = CredentialCache.DefaultCredentials
sr.Close()
Return result

End Function

The message I rcv is "Operation is not valid due to the current state of the object. "

N when I include try n catch in the function , I get the same msg but along with that the mail is aslo sent( without any text or controls, rather nothing is send)

How can I fix this problem. I have only 2 days.Pls help me out.

Thanks & Regards,
Ashima
Nov 22 '06 #1
0 769

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4799
by: Thom McGrath | last post by:
I'm writing a simple mailing list program, and I would like to know what the suggested method of sending a large number of emails to a list of addresses. (sounds like spam, no?) It's perfectly...
3
1936
by: Dave Moore | last post by:
Hi All, Is it possible to implement a mailing list using PHP?. I know I could maintain a list of emails addresses in a db and send mail to them through my website, but how can I get true mailing...
0
6359
by: Brian van den Broek | last post by:
Hi all, There have been a few posts over the last month or so expressing a bit of exasperation with the "rising tide of newbie's". (Or, more accurately, the rising tide of questions from...
0
1189
by: m_houllier | last post by:
I'm looking at undertaking a project for a group of charities. It's basically to enable them to send out newsletters and updates on what's going on and fundraising etc. The idea is, a webpage...
6
1635
by: Francois Suter | last post by:
To all French speakers on the list, I am pleased to announce the start of a PostgreSQL general mailing list in French. Its name is pgsql-fr-generale. I hope many of you will join it so that we...
3
2320
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
0
1109
by: sameer | last post by:
Hi, Steve i been trying to use this component paypay control which is really easy and excellent but this is what i think is the limitation and i just can not be done with. My checkout page...
2
13481
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
4
2527
by: Andy M | last post by:
ALERT There is a person by the name of Mike Cox who's trying to turn this mailing list into a Big-8 newsgroup. Many of you know that this and most of the other postresql mailing lists are...
3
2011
by: razjafry | last post by:
Hi Experts, I have two tables - tblContact and tblOrg Contact table has only one option of mailing address e.g address,city,postal code whereas Org table has two options - one simple address -...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.