asp.net mvc - Adding filename in url -
i want customize route in asp.net mvc.
@url.action("viewdoc", "home", new { filename = "abc.pdf" })
and
routes.maproute( name: "", url: "{controller}/{action}/{filename}", defaults: new { controller = "home", action = "viewdoc", filename = urlparameter.optional }
i get
http://localhost/home/viewdoc?filename=abc.pdf
how below?
http://localhost/home/viewdoc/abc.pdf
the code have pasted correct ordering in route setup wrong. move routes.maproute
method above default route , should work expected.
Comments
Post a Comment