is possible have controller/view url:
http://mydomain/somefolder/
and similar physical folder put files in it
http://mydomain/somefolder/*.*
currently url http://mydomain/somefolder/
, returns physical folder browsed if web.config allows it, return view , http://mydomain/somefolder/*.*
return files contained in folder.
yes, possible. let's suppose have ~/somefolder/foo.png
file , ~/controllers/somefoldercontroller
. need set routeexistingfiles
property true:
public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); routes.routeexistingfiles = true; }
now when navigate /somefolder
or /somefolder/index
index
action of somefolder
controller rendered. , when navigate /somefolder/foo.png
static file served.
Comments
Post a Comment