ASP.NET(MVC) - 渲染页面到一个文件 [英] ASP.NET (MVC) - render page to a file

查看:112
本文介绍了ASP.NET(MVC) - 渲染页面到一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一批静态HTML文件作为控制台/ WinForm的工作。目前的解决方案使用字符串建设者。曾使用ASP.NET MVC的使用强类型视图页面(System.Web.Mvc.ViewPage)我想知道是否有可能利用这些视图页面,并让它们输出到流或文件,而无需创建一个ASP.NET的解决方案。

I have to create a bunch of static html files as console / winform job. The current solution uses a string builder. Having used ASP.NET-MVC with strongly typed view pages (System.Web.Mvc.ViewPage) I was wondering if it is possible to leverage these view pages and have them output to a stream or file without building an ASP.NET solution.

基本上我想创造的ViewPage,通过在强类型的对象,并渲染的结果。

Essentially I'd like to create the viewpage, pass in the strongly typed object, and render the result.

我也开放给其他视图引擎。

I'm also open to other view engines.

如果这最终将需要在整个厨房的水槽,那么我可以做一个字符串生成器的风格。

If this ends up requiring bringing over the whole kitchen sink, then I can just do a string builder style.

感谢。

推荐答案

您需要的是一个模板引擎。我建议你​​ StringTemplate的。它可以用作独立的发动机,它有一个.NET版本。有一个$ C $的CProject 文章 ,可以让你开始。

What you need is a templating engine. I would recommend you StringTemplate. It can be used as standalone engine and it has a .NET version. There's a CodeProject article that could get you started.

据我所知ASP.NET的WebForms离不开ASP.NET基础设施上运行。

AFAIK ASP.NET WebForms cannot run without the ASP.NET infrastructure.

这篇关于ASP.NET(MVC) - 渲染页面到一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆