asp.net mvc - RouteHandler for Static Content -


we want route static content (js, css, images - png, gif, jpeg, jpg) of our application routehandler. we'll best practices speeding web sites. adding etags, cache control, expires, etc our static content.

how can that?

you should in iis.

but if want have total control on (can't find reason though!), can add catch route last route. like:

routes.maproute(     "static",     "{*path}",     new { controller = "home", action = "static"}); 

then add action control handle it:

public actionresult static(string path) {     //path after /     //use server.mappath load     //add headers response, etc     return file(); } 

but bad in opinion. obvious thing taking path url , map server. happens if path /../../windows/...? nothing, don't it.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -