Platform: Windows NT 4.0 or Windows 2000

Version  : VS.NET Beta 2 only

Requirements :  Favorite editor (whether SDI or MDI )

Method : Simply write the following code into a file and save it as MyTest.exe , then  try this out, perform the following steps:

  1. Copy The MyTest.cs and Test.aspx files to a local directory. 

  2. Compile MyTest.exe by typing csc MyTest.cs /r:System.Web.dll within a command prompt in the directory.

  3. Type MyTest.exe Test.aspx

One interesting use of this functionality is to pre-process dynamic ASP.NET requests saving the output as static .htm files that you then prop onto a server. You can do this with MyTest.exe by pipeing the output automatically to a static file. For example:

 MyTest.exe Test.aspx > Test.htm

----------------------------------------------
MyTest.cs
----------------------------------------------

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[ ] args ) 
{
MyExeHost host = ( MyExeHost )ApplicationHost.CreateApplicationHost ( typeof ( MyExeHost ), 
"/foo", Directory. CurrentDirectory ) ;
foreach ( String page in args ) 
{
host.ProcessRequest ( page ) ;
}
}
}
----------------------------------
Test.aspx
----------------------------------
<html>
<body>
<h1> Hi checking it out ! <%=Now%> </h1>
</body>
</html>