当前位置:网站首页 > Web学院 > 网站编程 > ASP.NET教程 > ASP.NET开发[打印] [收藏] 


官方参考手册,权威技术手册下载 阿里西西电子图书教程分类 myhost.cs 编译:
csc MyHost.cs /r:System.Web.dll

using System;
using System.IO;
using System.Web;
using System.Web.Hosting;


public class MyExeHost : MarshalByRefObject {

    public void ProcessRequest(String page)
        {
        HttpRuntime.ProcessRequest(new SimpleWorkerRequest(page, null, Console.Out));
        }

    public static void Main(String[] arguments)
        {
        MyExeHost host = (MyExeHost)ApplicationHost.CreateApplicationHost(typeof(MyExeHost), "/foo", Environment.CurrentDirectory);
           foreach (String page in arguments) {
            host.ProcessRequest(page);
        }
    }
}
test.aspx
<html>
        <body>
                Time is now: <%=Now%>
        </body>
</html>
成功后就可以用下面的方法执行
MyHost.exe Test.aspx > Test.htm
test.htm就是test.aspx执行后的结果

网友评论全部评论 

您还没登陆呢,点这里登陆共有 0  位网友发表了看法  
匿名发表 全部网友评论