On Feb 13, 12:13 pm, "arkgroup" <arkgr...@hotmail.comwrote:
I am generating asp.net page and need to send content of this page
(html) via email as attachment.
I have tried:
System.Web.HttpContext.Current.Request.SaveAs(Serv er.MapPath(".") + "\
\test.html", true);
but it has no actual page content.
Thanks
I usually do the following to get the html from a page.
StringBuilder sb = new StringBuilder();
HtmlTextWriter htw =new HtmlTextWriter(new StringWriter(sb));
// Render the page to it
Render(htw);
string strHTML = sb.ToString();
you can then use strHtml as the body of an email or for saving to a
file.