/// <summary>
        /// Creates an internal AspHost instance to allow the dispatcher to send requests off to the HttpRuntime
        /// </summary>
        internal void CreateAspHost()
        {
            try
            {
                string physicalDirectory = Application.StartupPath;                 // Path.Combine(Application.StartupPath, @"wwwroot");
                string configurationFile = Path.Combine(physicalDirectory, @"web.config");

                _aspHost = AspRuntime.CreateAspHost(@"/", physicalDirectory, string.Empty, configurationFile);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
 protected virtual void Dispose(bool disposing)
 {
     if (_disposed)
     {
         if (disposing)
         {
             if (_aspHost != null)
             {
                 _aspHost.Dispose();
                 _aspHost = null;
             }
         }
         _disposed = true;
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            const string pagePath = @"C:\Work\MS2\Source\TDMS\TCDS.Web\tdetail.asp";
            // @"C:\Work\MS2\Source\TDMS\TCDS.Web\ajax\tcds_tdetail_gcs.asp";
            var host = new AspHost(new AspHostConfiguration()
            {
            });
            AspPageDom page = new AspPageDom();

            //TODO: define some handlers for includes
            page.ProcessCode = ProcessCode;
            page.processPage(pagePath);
            //TODO: Can I process the code to pull out functions and page global variables?
            //TODO write to new file in new location
            string viewPath = @"C:\Work\MS2\Source\TDMS\TCDS.Web\Views\Home\" +
                              Path.GetFileNameWithoutExtension(pagePath) + "_New.vbhtml";

            File.WriteAllText(viewPath, page.Code);
        }
Exemplo n.º 4
0
 static AspView()
 {
     aspHost = new AspHost(null);
     //aspHost.LoadAssembly(typeof(IView).Assembly);
 }