.NETGURU
NOT ANSWERED BEFORE: Wrapping up html and mailing... changing characters...
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-mail' list.


Bryan Andrews
Does anyone know why this might be happening? Seems that asp.net is
taking 'creative license' with wrapping up the web content.

Any thoughts are appreciated.

-----Original Message-----
From: Bryan Andrews=20
Sent: Thursday, April 18, 2002 12:32 PM
To: ngfx-mail
Subject: [ngfx-mail] Wrapping up html and mailing... changing
characters...

I am using this code (posted at the bottom) to wrap up a web page and
email it to a client.

When it does this it alters 'Some words...' to 'Some words.'

Somehow it is removing the extra 2 '..'

Is there something I should be doing to prevent this?

Function readHtmlPage(ByVal url As String) As String
Dim objResponse As WebResponse
Dim objRequest As WebRequest
Dim result As String
objRequest =3D System.Net.HttpWebRequest.Create(url)
objResponse =3D objRequest.GetResponse()
Dim sr As New
StreamReader(objResponse.GetResponseStream())
result =3D sr.ReadToEnd()

'clean up StreamReader
sr.Close()

Return result
End Function

Sub btn_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
If EmailAddress.Text <> "" Then
Dim mail As New MailMessage()
mail.From =3D FromAddress.Text
'mail.BCC =3D request.form("EmailAddress")
mail.To =3D EmailAddress.Text
mail.Subject =3D Session("venuename") & "
Newsletter"
mail.Body =3D source
mail.BodyFormat =3D MailFormat.Html
SmtpMail.SmtpServer =3D "smtp.myserver.com"
SmtpMail.Send(mail)
Panel1.Visible =3D False
Dim strResponse As String =3D "You just sent an
email message formatted in HTML to:<br><BR>" & EmailAddress.Text & ".
<br><BR>Click <a href=3D'default.aspx?dc=3Dinvite'>here</a> to send
another!"
lblMessage.Text =3D strResponse
End If

| [ngfx-mail] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-mail.asp =3D JOIN/QUIT

Reply to this message...
 
    
Peter Brunone
Bryan,

    Sorry it's taken so long for you to get an answer. After some hurried
thought, the only thing that comes to mind is directory walking. There has
been quite a buzz about HTML mail security of late, and the .NET team may
have built this in as a safeguard (i.e. you use "../blah" to go up the
directory structure, and on the local host, this technique in a relative
link would logically take you up out of the user's temp mail directory into
a presumably private folder).
    If my assumption is correct, this should only happen inside link and script
tags, and the current behavior should be reported as a bug. I'll forward
your message to the ASP.NET team for their consideration.

Cheers,

Peter Brunone
AspFriends.com Moderation Team
Microsoft MVP, ASP.NET

|-----Original Message-----
|From: Bryan Andrews [mailto:Click here to reveal e-mail address]
|
|Does anyone know why this might be happening? Seems that asp.net is
|taking 'creative license' with wrapping up the web content.
|
|Any thoughts are appreciated.
|
|
|-----Original Message-----
|From: Bryan Andrews
|Sent: Thursday, April 18, 2002 12:32 PM
|To: ngfx-mail
|Subject: [ngfx-mail] Wrapping up html and mailing... changing
|characters...
|
|I am using this code (posted at the bottom) to wrap up a web page and
|email it to a client.
|
|When it does this it alters 'Some words...' to 'Some words.'
|
|Somehow it is removing the extra 2 '..'
|
|Is there something I should be doing to prevent this?
|
|
|
| Function readHtmlPage(ByVal url As String) As String
| Dim objResponse As WebResponse
| Dim objRequest As WebRequest
| Dim result As String
| objRequest = System.Net.HttpWebRequest.Create(url)
| objResponse = objRequest.GetResponse()
| Dim sr As New
|StreamReader(objResponse.GetResponseStream())
| result = sr.ReadToEnd()
|
| 'clean up StreamReader
| sr.Close()
|
| Return result
| End Function
|
| Sub btn_Click(ByVal sender As Object, ByVal e As
|System.EventArgs)
| If EmailAddress.Text <> "" Then
| Dim mail As New MailMessage()
| mail.From = FromAddress.Text
| 'mail.BCC = request.form("EmailAddress")
| mail.To = EmailAddress.Text
| mail.Subject = Session("venuename") & "
|Newsletter"
| mail.Body = source
| mail.BodyFormat = MailFormat.Html
| SmtpMail.SmtpServer = "smtp.myserver.com"
| SmtpMail.Send(mail)
| Panel1.Visible = False
| Dim strResponse As String = "You just sent an
|email message formatted in HTML to:<br><BR>" & EmailAddress.Text & ".
|<br><BR>Click <a href='default.aspx?dc=invite'>here</a> to send
|another!"
| lblMessage.Text = strResponse
| End If
|
|
|
|
|| [ngfx-mail] member Click here to reveal e-mail address = YOUR ID
|| http://www.aspfriends.com/aspfriends/ngfx-mail.asp = JOIN/QUIT
|
|| [ngfx-mail] member Click here to reveal e-mail address = YOUR ID
|| http://www.aspfriends.com/aspfriends/ngfx-mail.asp = JOIN/QUIT
|

Reply to this message...
 
    
aspNetEmail
Hi Bryan,
Hmm... I don't think this is ASP.NET's doing. Actually I think this may be
the mail client's doing. Can you tell me which mail reader you are using?
Also, have you verified this by viewing the source, pasting it into a text
email and then sending it out?

There is a special case about ".." and mail. When a connection is made to a
SMTP server, the connection ends with <CRLF>.<CRLF>. But what happens if you
actually have a <CRLF>.<CRLF> in the body of your message? When the SMTP
server sees that, it will prematurely terminate the session. To get around
that, mail senders (such as CDO) must replace <CRLF>.<CRLF> with
<CRLF>..<CRLF>. Then, mail readers must do a search and replace to convert
that back to <CRLF>.<CRLF>. I have a feeling that is what is happening here.
Someone is missing something here (don't know if it is CDO or the mail
reader). We actually ran into the problem when emailing webpages
ourselves, when we built aspNetEmail, and have compensated for it. For more
info, you may want to look at the RFC 821.

hth,
Click here to reveal e-mail address
www.aspNetEmail.com

----- Original Message -----
From: "Bryan Andrews" <Click here to reveal e-mail address>
To: "ngfx-mail" <Click here to reveal e-mail address>
Sent: Monday, April 29, 2002 5:55 PM
Subject: [ngfx-mail] NOT ANSWERED BEFORE: Wrapping up html and mailing...
changing characters...

Does anyone know why this might be happening? Seems that asp.net is
taking 'creative license' with wrapping up the web content.

Any thoughts are appreciated.

-----Original Message-----
From: Bryan Andrews
Sent: Thursday, April 18, 2002 12:32 PM
To: ngfx-mail
Subject: [ngfx-mail] Wrapping up html and mailing... changing
characters...

I am using this code (posted at the bottom) to wrap up a web page and
email it to a client.

When it does this it alters 'Some words...' to 'Some words.'

Somehow it is removing the extra 2 '..'

Is there something I should be doing to prevent this?

Function readHtmlPage(ByVal url As String) As String
Dim objResponse As WebResponse
Dim objRequest As WebRequest
Dim result As String
objRequest = System.Net.HttpWebRequest.Create(url)
objResponse = objRequest.GetResponse()
Dim sr As New
StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()

'clean up StreamReader
sr.Close()

Return result
End Function

Sub btn_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
If EmailAddress.Text <> "" Then
Dim mail As New MailMessage()
mail.From = FromAddress.Text
'mail.BCC = request.form("EmailAddress")
mail.To = EmailAddress.Text
mail.Subject = Session("venuename") & "
Newsletter"
mail.Body = source
mail.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "smtp.myserver.com"
SmtpMail.Send(mail)
Panel1.Visible = False
Dim strResponse As String = "You just sent an
email message formatted in HTML to:<br><BR>" & EmailAddress.Text & ".
<br><BR>Click <a href='default.aspx?dc=invite'>here</a> to send
another!"
lblMessage.Text = strResponse
End If

| [ngfx-mail] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-mail.asp = JOIN/QUIT

| [ngfx-mail] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-mail.asp = JOIN/QUIT

Reply to this message...
 
 
System.EventArgs
System.IO.StreamReader
System.Net.HttpWebRequest
System.Net.WebRequest
System.Net.WebResponse
System.Web.Mail.MailFormat
System.Web.Mail.MailMessage
System.Web.Mail.SmtpMail




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification