MVC default page
Here's the issue: When I press F5 to run the app, it tries to go to http://localport/Views/Home/Index.aspx and it gives a 404 error.
when I remove Views/Home/Index and give it just http://localport/ -- it goes to the Index page.
开发者_运维知识库I didn't change anything in the Routes in Global.ascx
What make it go to http://localport/Views/Home/Index.aspx
How can I change it?
That is a Visual Studio behavior. If you look at your Project Properties, under the Web tab, you can set a specific page to load when the app is run. By default VS uses the page you're viewing - but in this case assumes it is a non-MVC web form.
Press F5 when the current source file tab in focus is a .cs file (i.e. a Controller) instead of a .aspx file (i.e. a View).
Thats just a "bug" in Visual Studio. You had that view selected when you hit F5 so it tries to navigate directly to that page.
精彩评论