I have an Asp.Net Mvc 5 application backend. I want to add in my controller a function that creates html on the fly in a server folder. I want that this html is generated from template. Example:
Template:
<html><head/> <body> {CSharpVar} </body> </html>
in my controller:
MyObject mObj= new MyObject();
mObj.CSharpVar= "String TEst";
MyWantedClass.CreateHtml(htmlTemplate,mObj,outputPath);
What is the best way or best class to use?
您可以尝试使用作为Handlebars模板引擎的MustacheSharp ( nuget here )来编译模板,并在Visual Studio中使用自定义生成操作,以便它们在更改时重新编译。
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.