Example #1
0
        /// <summary>
        /// Process the request.
        /// </summary>
        /// <param name="page">The page to load.</param>
        /// <param name="request">The current http request.</param>
        /// <param name="streamWriter">The output stream writer.</param>
        public void ProcessRequest(string page, Nequeo.Net.Http.HttpRequest request, System.IO.StreamWriter streamWriter)
        {
            lock (_lockObject)
            {
                try
                {
                    // Execute the host.
                    _host.ProcessRequest(page, streamWriter, (String.IsNullOrEmpty(request.Url.Query) ? null : request.Url.Query));
                }
                catch (System.Runtime.Remoting.RemotingException)
                {
                    // Create a new host instance when this one is released.
                    _host = null;

                    // Create the application host.
                    CreateApplicationHost();
                    System.Threading.Thread.Sleep(400);

                    try
                    {
                        // Execute the host.
                        _host.ProcessRequest(page, streamWriter, (String.IsNullOrEmpty(request.Url.Query) ? null : request.Url.Query));
                    }
                    catch { }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Process the request.
 /// </summary>
 /// <param name="virtualDir">The virtual path to the application directory; for example, "/app".</param>
 /// <param name="physicalDir">The physical path to the application directory; for example, "c:\app".</param>
 /// <param name="page">The page to be requested (or the virtual path to the page, relative to the application directory).</param>
 /// <param name="output">A System.IO.TextWriter that captures output from the response.</param>
 /// <param name="query">The text of the query string.</param>
 /// <param name="processDefaultHttpHeaders">True if the http runtime process request is executed; else false.</param>
 /// <param name="configurationFile">The application configuration file (e.g. "web.config").</param>
 public virtual void ProcessRequest(string virtualDir, string physicalDir, string page, TextWriter output,
                                    string query = null, bool processDefaultHttpHeaders = true, string configurationFile = null)
 {
     // Execute the request.
     using (ApplicationHost applicationHost = new ApplicationHost())
     {
         Nequeo.Web.Hosting.Host host = (Nequeo.Web.Hosting.Host)applicationHost.CreateApplicationHost(typeof(Nequeo.Web.Hosting.Host), virtualDir, physicalDir, configurationFile);
         host.ProcessRequest(page, output, query, processDefaultHttpHeaders);
     }
 }