Is it possible to redirect content calls in ASP.NET?
I'm experimenting with javascript and css caching in ASP.NET MVC. Is it possible to intercept calls to the server for these types of files?
For example, if a request gets to the server for
~/Scripts/Something.CurrentVersion.js
I would like to intercept this call and tell the server to return
~/Scripts/SomeOtherFile.js
Would it be possible t开发者_JS百科o hook into some event or create a new module or HttpHandler to accomplish this?
Checkout these links for different ways:
http://weblogs.asp.net/rashid/archive/2009/04/28/script-and-css-management-in-asp-net-mvc.aspx http://weblogs.asp.net/rashid/archive/2009/05/02/script-and-css-management-in-asp-net-mvc-part-2.aspx http://www.codeproject.com/KB/aspnet/combineMinify.aspx
Yep. HttpHandler is certainly one way to go. Beware of the integration to IIS though - to have full control over mapping you have to run it in integrated mode - otherwise IIS itself will process request BEFORE it will get to the worker process
精彩评论