public IHttpHandler GetHttpHandler(RequestContext requestContext) { WebServiceHandlerFactory wshFactory = new WebServiceHandlerFactory(); return(wshFactory.GetHandler( HttpContext.Current, "GET,POST", VirtualPath, HttpContext.Current.Server.MapPath(VirtualPath))); }
void BeginRequest(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; string fpath = app.Context.Request.FilePath; if (string.IsNullOrEmpty(fpath)) { app.Context.RemapHandler( (IHttpHandler)Activator.CreateInstance(Type.GetType("System.Web.HttpNotFoundHandler, System.Web"))); } else { //Remove .asmx if (!_mappings.ContainsKey(fpath)) { //File not found app.Context.RemapHandler( (IHttpHandler)Activator.CreateInstance(Type.GetType("System.Web.HttpNotFoundHandler, System.Web"))); } else { //Web service handler WebServiceHandlerFactory factory = new WebServiceHandlerFactory(); MethodInfo mInfo = factory.GetType().GetMethod("CoreGetHandler"); IHttpHandler handlerToUse = (IHttpHandler) mInfo.Invoke(factory, new object[] { _mappings[fpath], app.Context, app.Request, app.Response }); app.Context.RemapHandler(handlerToUse); } } }
IHttpHandler IHttpHandlerFactory.GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { IHttpHandler handler = null; if (context.Request.QueryString != null) { pathTranslated = getPathTranslatedFromSiteGeneratorGUI(url, pathTranslated); } // check if it is an .aspx page if (".aspx" == Path.GetExtension(pathTranslated)) { context.RewritePath(url, url, context.Request.QueryString.ToString()); handler = PageParser.GetCompiledPageInstance(url, pathTranslated, context); } else if (".asmx" == Path.GetExtension(pathTranslated).ToLower()) { WebServiceHandlerFactory wshf = new WebServiceHandlerFactory(); handler = wshf.GetHandler(context, requestType, url, pathTranslated); } else { ProcessStaticContent(pathTranslated); // Process page and HttpContext.Current.Response.End(); // end here } return(handler); }
public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) { WebServiceHandlerFactory factory = new WebServiceHandlerFactory(); MethodInfo method = typeof(WebServiceHandlerFactory).GetMethod("CoreGetHandler", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(Type), typeof(HttpContext), typeof(HttpRequest), typeof(HttpResponse) }, null); return((IHttpHandler)method.Invoke(factory, new object[] { this.GetType(), context, context.Request, context.Response })); }
//private IWindsorContainer _container; #region IHttpHandler Members /// <summary> /// Process the aspx request. This means (eventually) rewriting the url and registering the page /// in the container. /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { string rawUrl = context.Request.RawUrl; log.Info("Starting request for " + rawUrl); DateTime startTime = DateTime.Now; // Rewrite url #region //Ali Ozgur: This is an ajax request, so we have to realign the rewritten url. if (context.Request["HTTP_X_MICROSOFTAJAX"] != null) { int idx = rawUrl.ToLowerInvariant().IndexOf("/default.aspx"); if (idx >= 0) { rawUrl = rawUrl.Substring(idx, rawUrl.Length - idx); } } #endregion WebServiceHandlerFactory factory = new WebServiceHandlerFactory(); IHttpHandler handler = factory.GetHandler(context, context.Request.RequestType, context.Request.FilePath, context.Request.FilePath); // Process the page just like any other aspx page handler.ProcessRequest(context); // Release loaded modules. These modules are added to the HttpContext.Items collection by the ModuleLoader. ReleaseModules(); // Log duration TimeSpan duration = DateTime.Now - startTime; log.Info(String.Format("Request finshed. Total duration: {0} ms.", duration.Milliseconds)); }
public ScriptHandlerFactory() { _wsFactory = new WebServiceHandlerFactory(); }
public ScriptHandlerFactory() { fallback = new WebServiceHandlerFactory(); }