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#"" %> "; string page = @"<%@ Page MasterPageFile=""My.master"" %>
"; 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 (); } } }