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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -