--- /dev/null
+using System;
+using System.Web;
+using System.Web.Hosting;
+
+namespace ClassLibrary1
+{
+ public class Class1:MarshalByRefObject
+ {
+ public void Run ()
+ {
+ HttpRuntime.ProcessRequest (new SimpleWorkerRequest ("PageWithMaster.aspx", "", Console.Out));
+ }
+ }
+}
+
--- /dev/null
+all: Program1.exe
+
+run-test: Program1.exe
+ mono Program1.exe
+
+dist-clean: clean
+ rm -rf bin My.master PageWithMaster.aspx
+
+clean:
+ rm -f Program1.exe Class1.dll
+
+Program1.exe: Program1.cs Class1.dll
+ gmcs -out:$@ -r:System.Web -r:Class1 Program1.cs
+
+Class1.dll: Class1.cs
+ gmcs -out:$@ -r:System.Web Class1.cs -target:library
--- /dev/null
+using System;
+using System.Web.UI;
+using System.Web;
+using System.Web.Hosting;
+using ClassLibrary1;
+using System.IO;
+
+namespace ConsoleApplication1
+{
+
+ class Program
+ {
+ static void Main (string[] args)
+ {
+ string master = @"<%@ Master Language=""C#"" %>
+<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
+<html xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" >
+<head id=""Head1"" runat=""server"">
+<title></title>
+</head>
+<body>
+<asp:contentplaceholder id=""Main"" runat=""server"" />
+</body>
+</html>";
+ string page = @"<%@ Page MasterPageFile=""My.master"" %>
+<asp:content id=""Content1"" contentplaceholderid=""Main"" runat=""server"">
+<form id=""form1"" runat=""server"" />
+</asp:content>";
+ string physDir = Directory.GetCurrentDirectory ();
+ if (!Directory.Exists ("bin"))
+ Directory.CreateDirectory ("bin");
+ string masterPath = "My.master";
+ if (!File.Exists (masterPath))
+ using (StreamWriter sw = new StreamWriter (masterPath))
+ sw.Write (master);
+ string pagePath = "PageWithMaster.aspx";
+ if (!File.Exists (pagePath))
+ using (StreamWriter sw = new StreamWriter (pagePath))
+ sw.Write (page);
+ Class1 c1 = (Class1) ApplicationHost.CreateApplicationHost (
+ typeof (Class1), "/", physDir);
+ c1.Run ();
+ }
+ }
+}
+