I use the method below to retrieve a page's content. I often use this technique to send invoices or receipts. You can create any page, then call this function to pull it into a string and send it as the email body.
public string GetUrl(string path)
{
using (StringWriter writer = new StringWriter())
{
Server.Execute(path, writer);
string html = writer.ToString();
path = "http://" + Request.ServerVariables["SERVER_NAME"] + ResolveUrl(path);
path = path.Substring(0, path.LastIndexOf("/") + 1);
//this is here so the css references from the theme are absolute paths
html.Replace("\"../", "\"" + path + "../");
return html;
}
}
Wednesday, November 21, 2007
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment