I was handed a new requirement and this one is new to me. After a day or two of research, I\'m still unable to figure this one out. The requirement is to find a way to send our
You will not be able to send any 'asp' code in an email and have it displayed correctly at the other end, you need a webserver in order to translate the asp code to the readable format on the screen.
Your idea about having a separate, unsecured page is spot on.
Another idea would be to 'print' the html to an image and send this.
Another option would be to generate a page that outputs html that is compatible with email clients and email this as the body.
Please do like this
Msg.Body += GetGridviewData(gvUserInfo);
function to convert gridview data
// This Method is used to render gridview control
public string GetGridviewData(GridView gv)
{
StringBuilder strBuilder = new StringBuilder();
StringWriter strWriter = new StringWriter(strBuilder);
HtmlTextWriter htw = new HtmlTextWriter(strWriter);
gv.RenderControl(htw);
return strBuilder.ToString();
}
Why not use a tool such as wkhtmltopdf c# wrapper or EvoPDF to convert the page to PDF and email as an attachment?
Please note: The wkhtmltopdf c# library is free whereas the EvoPDF is unfortunately a commercial product.