razorgenerator

Is it possible to save an MVC Razor view into an actual html file

蓝咒 提交于 2019-11-29 19:09:43
问题 We are building an MVC app that creates physical HTML pages. The app currently creates the pages dynamically using the normal MVC/Razor approach. Rather than re-creating the output programatically to a file, is there anyway to grab the result built by razor and save it to a file? Thanks so much! 回答1: you can render the view to string, then save the string in a file ... public string RenderViewToString(string viewName, object model) { ViewData.Model = model; using (var sw = new StringWriter())

RazorGenerator, Templates, and @Html

陌路散爱 提交于 2019-11-29 10:38:09
I'm trying to use RazorGenerator as an email template engine. I want to take a model with the data, assemble the correct set of partial views, and return HTML that I can email out. Edit: In addition to this workflow, any solution would need to be editable as a .cshtml file and be able to be compiled into a dll . For various reasons, it is not practical to deploy the cshtml files themselves - if we can't embed all our razor views into a single file, then we can't use that suggestion. Hence RazorGenerator. So far, I've worked out every part of it, except for the partials. When I try to use @Html

RazorGenerator, Templates, and @Html

天大地大妈咪最大 提交于 2019-11-28 03:51:50
问题 I'm trying to use RazorGenerator as an email template engine. I want to take a model with the data, assemble the correct set of partial views, and return HTML that I can email out. Edit: In addition to this workflow, any solution would need to be editable as a .cshtml file and be able to be compiled into a dll . For various reasons, it is not practical to deploy the cshtml files themselves - if we can't embed all our razor views into a single file, then we can't use that suggestion. Hence

Where can I find System.Web.Helpers, System.Web.WebPages, and System.Web.Razor?

浪尽此生 提交于 2019-11-26 18:57:10
I am following this article on RazorGenerator and it say's that I must add references to: System.Web.Helpers.dll System.Web.WebPages.dll System.Web.Razor.dll The only one I can see when I do Add Reference is System.Web.Razor , but I don't know where the other ones are. W3Max You will find these assemblies in the Extensions group under Assemblies in Visual Studio 2010, 2012 & 2013 (Reference Manager) I had the same problem , first I couldn't find those dlls in the list of .NET components . but later I figured it out that the solution is : 1- first I changed target framework from .NET framework

Where can I find System.Web.Helpers, System.Web.WebPages, and System.Web.Razor?

≡放荡痞女 提交于 2019-11-26 08:56:39
问题 I am following this article on RazorGenerator and it say\'s that I must add references to: System.Web.Helpers.dll System.Web.WebPages.dll System.Web.Razor.dll The only one I can see when I do Add Reference is System.Web.Razor , but I don\'t know where the other ones are. 回答1: You will find these assemblies in the Extensions group under Assemblies in Visual Studio 2010, 2012 & 2013 (Reference Manager) 回答2: I had the same problem , first I couldn't find those dlls in the list of .NET components