Display View in folder without Controller or Action in ASP.net MVC

后端 未结 4 1509
春和景丽
春和景丽 2021-01-15 17:29

I would like to display the view in the folder if no controller/action matches.

For example www.site.com/Home/Index, if I have the normal default route {controller}/

4条回答
  •  余生分开走
    2021-01-15 18:12

    You cannot and shouldn't the way you want. Views cannot be addressed by design (in the web.config in the /views folder theres an HttpNotFoundHandler mapped to * to ensure this)

    With that said, what you want here is not really standard so why do you want to do this, maybe we can come up with a better suggestion based on the reason behind this?

提交回复
热议问题