Exemple #1
0
        public virtual void ProcessRequest(HttpContext context)
        {
            // IIS will fire this event twice (or more?)  The HeadersWritten flag is false only on the first entry.
            // TODO: This is such a f*****g kludge to handle bizarre behavior on IIS.
            // if (context.Response.HeadersWritten) return;

            // Redirect to HTTPS if not local and not secure.
            if (!context.Request.IsLocal && !context.Request.IsSecureConnection && !httpOnly)
            {
                logger.Log(LogMessage.Create("Redirecting to HTTPS"));
                string redirectUrl = context.Request.Url.ToString().Replace("http:", "https:");
                context.Response.Redirect(redirectUrl);
                context.Response.Close();
            }
            else
            {
                string data             = new StreamReader(context.Request.InputStream, context.Request.ContentEncoding).ReadToEnd();
                NameValueCollection nvc = context.Request.QueryString;
                string nvcSerialized    = new JavaScriptSerializer().Serialize(nvc.AllKeys.ToDictionary(k => k, k => nvc[k]));
                // TODO: The removal of the password when logging is really kludgy.
                string parms = String.IsNullOrEmpty(data) ? nvcSerialized : data.LeftOf("Password").LeftOf("password");
                logger.Log(LogMessage.Create(context.Request.UserHostAddress + " - [" + context.Request.HttpMethod + ": " + context.Request.FilePath + "] Parameters: " + parms));

                IContext contextWrapper = new WebInterfaces.HttpContextWrapper(context);

                // If the pre-router lets us continue, the route the request.
                if (ServiceManager.Exists <IWebWorkflowService>())
                {
                    if (ServiceManager.Get <IWebWorkflowService>().PreRouter(contextWrapper))
                    {
                        ProcessRoute(contextWrapper, data);
                    }
                    else
                    {
                        // Otherwise just close the response.
                        context.Response.Close();
                    }
                }
                else
                {
                    ProcessRoute(contextWrapper, data);
                }
            }
        }
Exemple #2
0
        public virtual void ProcessRequest(HttpContext context)
        {
            IContext contextWrapper = new WebInterfaces.HttpContextWrapper(context);

            ProcessRequest(contextWrapper);
        }