Script Resource Viewer

This post describes the Script Resource Viewer, a tool that I have written to help developers understand and debug problems with the WebResource and ScriptResource HTTP Handlers. You can download the Script Resource Viewer on the .NET Internationalization site’s download page here.

If you have written ASP.NET AJAX applications and added ScriptReferences to the ScriptManager to refer to embedded JavaScript resources then you will have seen references to WebResource and ScriptResource in the generated page’s source at runtime. Here are the references from a simple web application:-

script src="/WebResource.axd?d=xzGDNKJs2hXyJqyidRG7rw2&t=633197888003670000" type="text/javascript"

script src="/ScriptResource.axd?d=cw0uZacoMljB_qHR-taqzzVXRZfsZdED8KtIdT8S4lxFp4FZiYkg1XMRiHm-
asNXbF50agKpU_mlwC_4UD1LjTtZIb8n0Iwtdp5j00hh_IM1&t=633200995411179848" type="text/javascript"

script src="/ScriptResource.axd?d=cw0uZacoMljB_qHR-taqzzVXRZfsZdED8KtIdT8S4lxFp4FZiYkg1XMRiHm-asNXbF50agKpU_mlwC_4UD1LjbQaIEzjJXk-
4Bu42FIEg4o1&t=633200995411179848" type="text/javascript"

script src="/ScriptResource.axd?d=Eayesv7vnHyEzSx83kYu3sZw_Ff6xhZWa9dVaMiOEVbTzulF5yuG_e_a0C
C6RS_16wJy1E10ZcWsesSXhTHQ2uyvpOmBnccO9vh7FSD3sP3P1nOe8f8kwq9qjkbsrs2H0&t=633203771948586000" type="text/javascript"

The src attribute of these script elements points to the WebResource and ScriptResource HTTP handlers and pass in two parameters: d (data) and t (time). Whereas the t parameter is simply a number of ticks and represents the time of the assembly file from which the resource was drawn the d parameter is not nearly so easy to understand because it is encrypted. Enter the Script Resource Viewer.


The first thing you will notice about the Script Resource Viewer is that it is as ugly as sin. I admit it - it’s the kind of ugly that frightens small children. I think it’s fair to say that my talents lie more on the functionality side of software development than the aesthetically pleasing user interfaces side of software development.

The second thing that you will notice is that there is a big box where you can paste in a WebResource or ScriptResource from one of your pages. I have pasted in the fourth line from examples above and clicked on the Decrypt button. (If the Script Resource Viewer fails at this point the most likely explanation is that you are attempting to decrypt a string generated by one version of the ASP.NET AJAX Framework on a machine with a different version of the ASP.NET AJAX Framework. Try rebuilding generating a fresh page on the same machine and using the WebResource or ScriptResource from that page).


The Decrypt button decrypts the d and t parameters and breaks them down into recognisable fragments. In this example you can see that the first character is Z (indicating that the result should be returned GZipped), the second parameter is the assembly name (AJAXWebEnabledApplicationI18N1), the third parameter is the fully qualifed resource name to retrieve from the assembly (AJAXWebEnabledApplicationI18N1.DisplayFunctions.js) and the fourth parameter is the culture to return the resource for (fr, i.e. French).

The "Show Resource Uri" button rebuilds a URI from the value in the "Server Uri" field and the decrypted d and t parameters. However, there is an all-important difference between the original URI passed to ScriptResource and the rebuilt URI (apart from the Server Uri prefix). The first character of the d parameter is a u and not a Z. The difference means that the ScriptResource will return unzipped script instead of GZipped script. Th

Currently rated 3.3 by 31 people

  • Currently 3.258065/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Guy Smith-Ferrier
Posted on: Wednesday, July 18, 2007 at 10:37 PM
Categories: AJAX
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Comments