简体   繁体   中英

Including the original script name when using asp.net scriptmanager / scriptresource.axd

I am working on an asp.net web app with typically 30 different ScriptManager scripts referenced (as ScriptResource.axd?d=[encrypted-script-name] )

This makes it difficult to find the right script when debugging in eg firebug. It would be great if there was some way the original filename could be appended to the script url in debug mode, eg

ScriptResource.axd?d=[encrypted-script-name]&orig=MyScript.js

(I realise that this should be debug only!)

Is there a way to do it?

One of the way could be not to use ScriptManager to serve the scripts in say debug mode - for example

protected void ScriptManager_PreRender(object sender, EventArgs e)
{
  // include normal script references in debug mode, SM is script manager instance name
  if (SM.IsDebuggingEnabled)
  {
    foreach (var script in SM.Scripts)
    {
       // based on script properties, use RegisterClientScriptResource 
       // or RegisterClientScriptInclude methods of Page.ClientScript
    }
    SM.Scripts.Clear();
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM