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
Post a Comment