我爱Aspx >> Asp.Net >> 用C#实现无需iiS环境就可以执行aspx文件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执行后的结果
Asp.net中DataGrid控件的自定义分..[04-29]
“用户 HP-2V47VI88M4GB\ASPNET ..[04-29]
ASP.net发邮件的例程WEB MAIL[04-29]
解决ASP.NET上传文件大小限制[04-29]
asp.net下的日历控件源代码[04-29]
关于Asp.Net中的编程实现下载[04-29]
Community 学习(C#版)[04-29]
建立ASP.NET开发平台[04-29]
ASP.NET[04-29]
ASP.NET 程序设计-序[04-29]
Asp.net中DataGrid控件的自定义分..[04-29]
“用户 HP-2V47VI88M4GB\ASPNET ..[04-29]
ASP.net发邮件的例程WEB MAIL[04-29]
解决ASP.NET上传文件大小限制[04-29]
asp.net下的日历控件源代码[04-29]
关于Asp.Net中的编程实现下载[04-29]
UrlReWriter 使用经验小结[04-29]
RadioButton Web 控件[04-29]
RadioButtonList Web 控件[04-29]
ListItem Web 控件[04-29]