My page loads scripts and css from some custom assembly. For now, I use the ScriptManager to add scripts to the page (its CompositeScript) and the page's ClientScript.GetWebResourceUrl() for css files. So, on the page(s) my scripts are referenced by /ScriptResource.axd and css are referenced by /WebResource.axd. Works fine except the fact that those URLs look really ugly. Is there any manageable way to replace those urls with my own fake paths without moving/hosting script/css physical files somewhere? Any help or ideas would be greatly appreciated.
            Asked
            
        
        
            Active
            
        
            Viewed 919 times
        
    2
            
            
         
    
    
        Greg B
        
- 14,597
- 18
- 87
- 141
- 
                    2Who's going to see the URLs? Do you have a concern relating to SEO or some other factor? – Greg B Feb 21 '11 at 17:26
- 
                    Not really. I guess I'm just trying to find out if it's possible at all. I coded my last project in MVC and co-workers were quite impressed how clean that HTML looked. That's the root of the question. And no, I can't move this project to MVC :) – Feb 21 '11 at 17:58
- 
                    You'd have to create your own HTTP handler... – Brian Mains Feb 21 '11 at 18:11
1 Answers
1
            Use a Filter to find all the WebResource.axd and ScriptResource.axd src'es and replace them with something you like better. You then need a IHttpHandler, as Brian comments, that understands your new url-format and returns the same content as the original axd-files would have.
You should also look into combining all those script and css resources to save requests from the browser. How do I combine WebResource.axd and ScriptResource.axd files so as to result in less requests to my ASP.NET server?
 
    
    
        Community
        
- 1
- 1
 
    
    
        Pauli Østerø
        
- 6,878
- 2
- 31
- 48