GetHandler() public méthode

Returns an object that implements the IHttpHandler interface and which is responsible for serving the request.
public GetHandler ( System.Web.HttpContextBase context, string requestType, string url, string pathTranslated ) : IHttpHandler
context System.Web.HttpContextBase
requestType string
url string
pathTranslated string
Résultat IHttpHandler
Exemple #1
0
        public override void ExecuteResult(ControllerContext context)
        {
            var factory = new ErrorLogPageFactory();

            if (!string.IsNullOrEmpty(_resouceType))
            {
                var pathInfo = "/" + _resouceType;
                context.HttpContext.RewritePath(FilePath(context), pathInfo,
                    context.HttpContext.Request.QueryString.ToString());
            }

            var currentApplication = (HttpApplication) context.HttpContext.GetService(typeof (HttpApplication));

            if (currentApplication == null)
                return;

            var currentContext = currentApplication.Context;

            var httpHandler = factory.GetHandler(currentContext, null, null, null);
            var handler = httpHandler as IHttpAsyncHandler;

            if (handler != null)
            {
                var asyncHttpHandler = handler;
                asyncHttpHandler.BeginProcessRequest(currentContext, (r) => { }, null);
            }
            else
            {
                if (httpHandler != null)
                    httpHandler.ProcessRequest(currentContext);
            }
        }
        public override void ExecuteResult(ControllerContext context)
        {
            if (!string.IsNullOrEmpty(_resourceType))
            {
                var pathInfo = "." + _resourceType;
                HttpContext.Current.RewritePath(PathForStylesheet(), pathInfo, HttpContext.Current.Request.QueryString.ToString());
            }

            var factory = new ErrorLogPageFactory();
            var httpHandler = factory.GetHandler(HttpContext.Current, null, null, null);
            httpHandler.ProcessRequest(HttpContext.Current);
        }
Exemple #3
0
        public override void ExecuteResult(ControllerContext context)
        {
            var factory = new Elmah.ErrorLogPageFactory();

            if (!string.IsNullOrEmpty(_resouceType))
            {
                var pathInfo = "." + _resouceType;
                HttpContext.Current.RewritePath(PathForStylesheet(), pathInfo, HttpContext.Current.Request.QueryString.ToString());
            }

            var httpHandler = factory.GetHandler(HttpContext.Current, null, null, null);
            var elmahSqlErrorLog = (ElmahSqlErrorLog)ErrorLog.GetDefault(HttpContext.Current);
            elmahSqlErrorLog.ErrorType = new List<string> { "x", "y" };
            httpHandler.ProcessRequest(HttpContext.Current);
        }
Exemple #4
0
        public override void ExecuteResult(ControllerContext context)
        {
            var url = new UrlHelper(HttpContext.Current.Request.RequestContext);
            var factory = new ErrorLogPageFactory();
            if (!string.IsNullOrEmpty(resourceType))
            {
                var pathInfo = "." + resourceType;
                var action = url.Action("Index", "Elmah", new { type = (string)null });
                HttpContext.Current.RewritePath(action, pathInfo, HttpContext.Current.Request.QueryString.ToString());
            }

            var handler = factory.GetHandler(HttpContext.Current, null, null, null);

            handler.ProcessRequest(HttpContext.Current);
        }
        public override void ExecuteResult(ControllerContext context)
        {
            var factory = new ErrorLogPageFactory();

            if (!string.IsNullOrEmpty(_resouceType))
            {
                string pathInfo = "/" + _resouceType;
                context.HttpContext.RewritePath(FilePath(context), pathInfo,
                                                context.HttpContext.Request.QueryString.ToString());
            }

            HttpContext currentContext = GetCurrentContextAsHttpContext(context);

            IHttpHandler httpHandler = factory.GetHandler(currentContext, null, null, null);
            var httpAsyncHandler = httpHandler as IHttpAsyncHandler;

            if (httpAsyncHandler != null)
            {
                httpAsyncHandler.BeginProcessRequest(currentContext, r => { }, null);
                return;
            }

            httpHandler.ProcessRequest(currentContext);
        }