I have this function:
public static string RenderViewToString(string controlName, object viewData) {
    ViewDataDictionary vd = new ViewDataDictionary(viewData);
    ViewPage vp = new ViewPage { ViewData = vd };
    Control control = vp.LoadControl(controlName);
    vp.Controls.Add(control);
    StringBuilder sb = new StringBuilder();
    using (StringWriter sw = new StringWriter(sb))
    {
        using (HtmlTextWriter tw = new HtmlTextWriter(sw))
        {
            vp.RenderControl(tw);
        }
    }
    return sb.ToString();
}
And I call it like this:
string body = StringHelpers.RenderViewToString("~/Areas/Public/Views/Shared/RegistrationEmail.ascx", new RegistrationEmailViewModel { User = user });
And it returns a html-table with the user-info.
But I was wondering if there is a way to edit this to I can can return a View as string? so I can add masterpage, so it'll be easier to design all potential mails going out?
Thanks in advance /M
 
     
    