简体   繁体   中英

MVC 5 Change the home page

我有按预期在本地运行的MVC5应用程序,当我运行它时会自动打开主页,我在视图中有额外的文件夹,我可以通过指定路径导航到它们(例如http://12.0.0.1:80/List/Index )现在我想改变它,当我运行主项目( http://12.0.0.1:80 )时,它会自动打开页面http://12.0.0.1:80/List/Index ,我应该怎么做?

进入您的RouteConfig.cs在文件App_Start项目的文件夹,并更改默认的路由约束到controller="List" ,而不是controller="Home"

Use routes if you want the url to stay as http://12.0.0.1:80 but with the new content

Use redirect if you want the url to change to http://12.0.0.1:80/List/Index

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM