出口ASPX为HTML [英] Export ASPX to HTML
问题描述
我们正在建立一个CMS。该网站将建成并通过在aspx页面的用户管理,但我们想创建HTML的静态网站。
我们现在正在做的方式是用code,我发现这里一>是重载的aspx页面渲染方法和HTML字符串写入到文件中。这对于单页工作正常,但与我们的CMS的事情是,我们要自动创建从一开始就正确的网站了几个HTML网页,甚至在创作者编辑系统中的任何东西。
有谁知道任何方式做到这一点?
We're building a CMS. The site will be built and managed by the users in aspx pages, but we would like to create a static site of HTML's. The way we're doing it now is with code I found here that overloads the Render method in the Aspx Page and writes the HTML string to a file. This works fine for a single page, but the thing with our CMS is that we want to automatically create a few HTML pages for a site right from the start, even before the creator has edited anything in the system. Does anyone know of any way to do this?
推荐答案
调用渲染
方法仍然是pretty简单。只要创建你的页面的一个实例,创建一个存根 WebContext
随着的WebRequest
对象,然后调用渲染
页面的方法。然后您就可以自由地做任何你想要的结果。
Calling the Render
method is still pretty simple. Just create an instance of your page, create a stub WebContext
along with the WebRequest
object, and call the Render
method of the page. You are then free to do whatever you want with the results.
另外,写上你想使静态为准页面有点卷曲
或的wget
脚本,下载和存储。
Alternatively, write a little curl
or wget
script to download and store whichever pages you want to make static.
这篇关于出口ASPX为HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!