I need to be able to temporarily disable bundling and minification for a single request for the purpose of debugging JavaScript & CSS Issues. I would like to do this at run time by adding a parameter to the QueryString like so..
http://domain.com/page?DisableOptimizations=true
Here's the approach I am considering.
protected void Application_BeginRequest(object sender, EventArgs e)
{
// Enable for every request
BundleTable.EnableOptimizations = true;
// Disable for requests that explicitly request it
bool disable;
bool.TryParse(Context.Request.QueryString["DisableOptimizations"], out disable);
if (disable)
{
BundleTable.EnableOptimizations = false;
}
}
- Are there any potential issues with the fact that I am setting this static property on every web request? (The web app will run on a web farm)
- Are there better ways to handle this?