Emailing a dynamically generated aspx page

G

Gary Coutts

Hi,

After dynamically generating an aspx page I need to email what is being
displayed by the browser.

I have looked at System.Web.Mail but it looks like you have to generate the
body of the message as one long string.

Can anyone point me in the right direction.

I am using VS2003 ASP 1.1.


Cheers

Gary Coutts
 
Q

q

Here's a sample... pay close attention to the Render method.

public bool SendEmail {
get { return sendEmail; }
set { sendEmail = value; }
}

void btnConfirm_Click(object sender, EventArgs e) {
try {
OrderHeaderEntity header = new OrderHeaderEntity(new
Guid(this.OrderId));
header.OrderSent = true;
header.Save( );

this.SendEmail = true;
}
catch (Exception ex) {
lblErrorMessage.Text = ex.Message;
}
}

protected override void Render(HtmlTextWriter writer) {
StringBuilder builder = new StringBuilder();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(new
StringWriter(builder));
base.Render(htmlTextWriter);
string output = builder.ToString();
writer.Write(output);
if (this.SendEmail) {
this.SendEmail = false;
SendEmail(output);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top