/// <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; string rawUrl = context.Request.Url.PathAndQuery; log.Info("Starting request for " + rawUrl); DateTime startTime = DateTime.Now; // Rewrite url UrlRewriter urlRewriter = new UrlRewriter(context); string rewrittenUrl = urlRewriter.RewriteUrl(rawUrl); // Obtain the handler for the current page string aspxPagePath = rewrittenUrl.Substring(0, rewrittenUrl.IndexOf(".aspx") + 5); IHttpHandler handler = PageParser.GetCompiledPageInstance(aspxPagePath, context.Server.MapPath(aspxPagePath), context); // 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)); }
private void context_BeginRequest(object sender, EventArgs e) { HttpContext context = ((HttpApplication)sender).Context; context.Items["RequestStart"] = DateTime.Now; string rawUrl = context.Request.RawUrl; log.Info("Starting request for " + rawUrl); DateTime startTime = DateTime.Now; if (rawUrl.Contains(".aspx")) { // Rewrite url UrlRewriter urlRewriter = new UrlRewriter(context); urlRewriter.RewriteUrl(rawUrl); } }