public static void CreateContext(OfflineWebSession webSession, string method, string url, NameValueCollection postData) { WebAppConfig.Init(webSession.MapPath); HttpContextBase context = new OfflineHttpContext(webSession, method, url, postData); Current = context; context.SessionObject = WebAppHelper.CreateSessionObject(); WebAppConfig.Fire_SessionCreated(context.SessionObject); }
public static void CreateContext(HttpContext httpContext) { WebAppConfig.Init(); HttpContextBase context = new OnlineHttpContext(httpContext); Current = context; if (httpContext.Session == null) { return; } context.SessionObject = WebAppHelper.CreateSessionObject(); WebAppConfig.Fire_SessionCreated(context.SessionObject); }
private static void PostMapRequestHandler(object sender, EventArgs e) { WebAppConfig.Init(); HttpContext httpContext = ((HttpApplication)sender).Context; RequestData requestData = (httpContext.Items[_contextItemKey] as RequestData); if (requestData != null) { httpContext.RewritePath(requestData.Url); if (requestData.Handler != null) { httpContext.Handler = requestData.Handler; } } }
private static void PostResolveRequestCache(object sender, EventArgs e) { WebAppConfig.Init(); HttpContext httpContext = ((HttpApplication)sender).Context; HttpRequest httpRequest = httpContext.Request; IHttpHandler httpHandler = null; string path = UrlHelper.GetUrlPath(httpRequest.AppRelativeCurrentExecutionFilePath, httpRequest.PathInfo); if (path.StartsWith("_$ajax$_.axd/")) { httpHandler = new AjaxPageHandler(path); } else if (path.StartsWith("_$res$_.axd")) { httpHandler = new ResourceHttpHandler(path); } else { ControllerAction controllerAction = WebAppHelper.GetControllerAction(path); if (controllerAction != null) { httpHandler = new PageHandler(new MvcPageHandler(controllerAction)); } } if (httpHandler != null) { httpContext.Items[_contextItemKey] = new RequestData(httpContext.Request.RawUrl, httpHandler); httpContext.RewritePath("~/ProMesh.axd"); } }