i am trying to read a Razor formatted (.cshtml) file's content to be parse into Razor.Parse method to send an Html Email out. However I have problem reading the file from the webservice. How can i get the string content from the .cshtml file?
public class SendConfirmationEmailService : Service
{
public ConfirmationEmailResponse Post(ConfirmationEmailRequest request)
{
var emailModel = new EmailModel{ };
var templateString = ???????
var body = Razor.Parse(templateString, emailModel);
}
}
尝试这个
var html = System.IO.File.ReadAllText(Server.MapPath("~/") + "FileNameWithPath");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.