c# - Set 'cshtml' data and return a string -
i have confirmation email template .cshtml
following:
<html> <head> <title>company name: email verification - action required</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> signing company name! <br/> <br/> thank signing company name. please press link below confirm email address <br/> if did not sign company name, please ignore email, , accept our apologies inconvenience. <br/> <br/> <a href="@model.confirmlink">@model.confirmlink</a> <br/> <br/> <br/> thanks,<br/> <a href="http://company name.com" >company name</a> team </table> </body> </html>
is there mechanism can set data (@model.confirmlink
) , result string
? (not manually replace string)
you can use razorengine, uses same syntax razor does, gives ability render text without need of asp.net mvc.
how code work:
string template = yourhtmlcodeasstring; string result = razor.parse(template, new { confirmlink = "http://.../" });
you can load template string file, resource, etc.
Comments
Post a Comment