I love ASP.NET ScriptManager and ScriptManagerProxy, the most most obvious convenience they allow me to include scripts without having to concern whether the scripts have been included.  That’s if Script A is included in Master Page’s ScriptManager, and also included in content page’s ScriptManagerProxy as well as content page’s user component’s ScriptManagerProxy, the final HTML would only include Script A once.

However, there is a gotcha that most developers are not aware of — when the script file is declared, it is CASE SENSITIVE, that’s Abc.js is considered different from ABC.js.  In other words, if the master page includes Abc.js, and content page includes ABC.js, the same script would be included TWICE.

This is counter intuitive as Microsoft’s OS is never case sensitive.  To avoid this problem, I use my good old Unix/Linux trick — I always humbly name my files and directories using lower case, so I can consistently reference them using lower case.  It takes the guessing out of the game.

Happy coding!

Advertisements