In my web project's business object editor page, I'm sending a notification email to the administrator after an object insert or update. But instead of sending a plain text mail, i want to send the html output of another aspx page(Notification.aspx) i simply prepared for this purpose.
First i thought, I can create an instance of Notification.aspx then use it's RenderControl method for getting the output.
However, in the codebehind of Editor.aspx page, i can't even reach the Notification's reference to create a new instance.
I wonder what is the best practice for loading and rendering a page in another one...
Thanks.
You can render a page by doing this:
StringWriter _writer = new StringWriter();
HttpContext.Current.Server.Execute("MyPage.aspx", _writer);
string html = _writer.ToString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With