为了调试JavaScript和CSS问题,我需要暂时禁用单个请求的捆绑和缩小功能。我想在运行时通过向QueryString添加一个参数来完成这个任务,就像这样:
http://domain.com/page?DisableOptimizations=true
这是我正在考虑的方法。
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;
}
}
相似问题