ASP.net MVC 5 Route with two parameter -


i want create web application 2 parameter. add code registerroutes function:

routes.maproute(                "pageroute",                                                              "page/{pageid}/{pagename}",                                          new { controller = "page", action = "index", pageid = "", pagename = "" }             ); 

and add method in pagecontroller:

  public actionresult index(int pageid,string pagename)         {             return view();         } 

now when running application parameter

http://localhost:1196/page/4/pagename 

application run when running parameter

http://localhost:1196/page/4/pagename.html 

application return 404 error

http error 404.0 - not found resource looking has been removed, had name changed, or temporarily unavailable. 

while add .html in parameter return 404 error. why?

because default html files not being served through mvc/iis.

your application looks physical file named pagename.html , cannot find there. hence - 404.

to make work, need setup iis catch requests files html extension , pass request mvc.

edit: here similar question op found solution switching "managed pipeline mode" "classic".


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -