One interesting uses of ASP.NET is to "pre-process" dynamic ASP.NET requests - saving the output as static.htm files that can be copied to the web-server. You can do this with MyHost.exe by"piping" the output automatically to a static file. Thiswas originally obtained on Charles Carroll's ASPNGFreeforAll posted by Scott Guthrie from Microsoft. Note:This example has been updated for RTM v1.0. For example: To try this out, perform the following steps:
1) Copy The MyHost.cs, mk.bat and Test.aspx files to a local virtual directory 2) Compile MyHost.exe by running mk.bat "csc MyHost.cs /r:System.Web.dll" within a command prompt in the directory 3) Create a directory called bin in virtual sub-directory and copy the myhost.exe file to the bin directory 4) Type "MyHost.exe Test.aspx > test.htm". | c:inetpubwwwrootMyHost.exe Test.aspx > Test.htm 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.asx Code ----------------------------------------
<html> <body> Time is now: <%=Now%> </body> </html>
---------------------------------------- mk.bat Code ----------------------------------------
csc MyHost.cs /r:System.Web.dll | | DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP.NET Articles More By aspfree developerWorks - FREE Tools! | This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process. FREE! Go There Now!
| | | | Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance. FREE! Go There Now!
| | | | Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development FREE! Go There Now!
| | | | Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools. FREE! Go There Now!
| | | | Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML. FREE! Go There Now!
| | | | Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications. FREE! Go There Now!
| | | | XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. FREE! Go There Now!
| | | | Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered! FREE! Go There Now!
| | | | Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
| | | | Discover how Rational tools and best practices for testing can make your job easier. The new Rational Testing eKits provide you with valuable resources – including demos, webcasts, tutorials, and articles – that help you address your specific testing needs across the software lifecycle. Five new eKits are available covering the topics of Requirements and Test Management, Functional Testing, Performance Testing, Code Quality and Embedded Systems, and SOA and Web Services Testing. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |