MVC default page

0 votes
asked Nov 24, 2010 by joe

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?

3 Answers

0 votes
answered Nov 24, 2010 by alex

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).

0 votes
answered Nov 24, 2010 by derek

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.

0 votes
answered Nov 24, 2010 by fabian

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.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...