protected void Application_BeginRequest(object sender, EventArgs e) { string inputPath = Request.Url.LocalPath.ToLower(); string inputQueryString = Request.QueryString.ToString(); string siteid = ConfigurationManager.AppSettings["SiteID"]; string outputUrl = ""; bool isEditMode = (Request.QueryString["mode"] == "edit"); //Genereer het werkelijke path en controlleer of het een echt bestand is of dat het een virtueel bestand is. //string serverPath = Server.MapPath("") + inputPath; //serverPath = serverPath.Replace("/", "\\"); if (inputPath.StartsWith("/_bit") || inputPath == "/page.aspx") //|| File.Exists(serverPath)) { return; } else if (inputPath.EndsWith(".css") || inputPath.EndsWith(".js")) { if (inputPath.Contains("jquery-1.8.2.js") || inputPath.Contains("bit") || inputPath.Contains("jquery.iframe-post-form.js") || inputPath.Contains("JSON.js")) { return; } string scriptid = CmsScript.GetScriptIDByUrl(inputPath, siteid); //Geen script ID? Dan gewoon de orginele URL doorsturen. if (scriptid == "" || scriptid == null) { return; } outputUrl = "/script.handler?scriptid=" + scriptid; Context.RewritePath(outputUrl); } else { outputUrl = UrlRewriter.GetOriginalUrl(inputPath, inputQueryString, siteid, isEditMode); } //Reload bitBundler na dat een backup is terug gezet. if (Request.QueryString.AllKeys.Contains("ReloadScripts")) { BitBundler.Init(); } if (outputUrl != string.Empty) { Context.RewritePath(outputUrl); } }
protected void Application_Start(object sender, EventArgs e) { //BundleConfig.RegisterBundles(BundleTable.Bundles); BitBundler.Init(); Translator.InitStaticValues(); //Test //System.Reflection.PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); //object o = p.GetValue(null, null); //System.Reflection.FieldInfo f = o.GetType().GetField("_dirMonSubdirs", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.IgnoreCase); //object monitor = f.GetValue(o); //Returns NULL //System.Reflection.MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); m.Invoke(monitor, new object[] { }); }