Render static html with helper
For rendering static html (saved into external file) into mvc view:
public static MvcHtmlString WebPage(this HtmlHelper htmlHelper, string serverPath)
{
var filePath = HttpContext.Current.Server.MapPath(serverPath);
return MvcHtmlString.Create(new WebClient().DownloadString(filePath));
}
Calling as is:
@Html.WebPage("~/staticFile.htm")
Written by Maria Manenti
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mvc
Authors
Related Tags
#mvc
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#