public ActionResult Default()
{
ViewBag.Message = "Hello,World!";
var template = "<h1>@ViewBag.Message</h1>";
//How to make the content of the following "View" = "template"
return View();
}
Then build html result as:
<h1>Hello,World!</h1>
Plase help me,Thanks! I know RazorEngine can parse Razor file,but can’t Render string to View.
use the content result instead, which returns the raw content. It does not use an associated view, but only returns content directly to the requestor.