Search code examples
asp.netwebresource

Asp.NET Webresources with better URL


it is possible to write own "webresources provider" in asp.net to change webresources URL which looks like:

WebResource.axd?d=qoS8iGdUsV4f8NgR_HS-hHWgRO2CDfStRaaqn7oJ2xBuwIMbn27JNufuUMn-aVlK0& t=634013997250859375"

to e.g.:

/webresources/folder/script.js

?

Thanks


Solution

  • If I could realize, you are after to change this behavior for all of controls (included already existed controls) which is impossible unless override their behavior. Most web controls use embedded resources and do not support custom script path.

    ASP.NET uses AssemblyResourceLoader to handle .axd requests and Page.ClientScript.GetWebResourceUrl() that should be used to get the WebResource path, uses AssemblyResourceLoader.GetWebResourceUrl() internally. You can not change the ClientScriptManager behavior. Whereas ClientScriptManager class is seald and Page.ClientScript does not have setter accessor and is not overridable.