tags:

views:

51

answers:

2

Hello,

I have a task in hand that requires me to send a form to a client by email as soon as it is submited.

My question is: Having an aspx(in order to reuse my form) how can I get the generated html to send it by mail?

Thanks in advance

EDIT: I know how to send emails, what I am looking for is how to get the html that is generated in my webform so i can place it in the email.

+1  A: 

Using the SmtpMail class in System.Web?

Arnshea
edited my question to clarify
Sergio
+2  A: 

You should be able to call Render on it and stream it.

StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
Page.RenderControl(htmlWriter);
string output = stringWriter.ToString();
Otávio Décio
That was my first try... the result of stringWriter.ToString() is "System.Web.UI.HtmlTextWriter"
Sergio
Never mind that comment, I guess i am tired... It works ;) Thanks
Sergio