3
votes

I'm working on an ASP project, and probably will be for a very long time. Which is fine with me because I've fallen in love with MVC, it completely eliminates -most- things I hate about web dev. That said, I has a problem..

So, I right clicked a new index and set it as the start page and now it sends me to..

http://localhost:9240/Views/Home/Index.cshtml

But the URL that works is http://localhost:9240/Home/Index

So when I start the project it 404's

3

3 Answers

3
votes

In mvc you don't set startup page. To set a default page you can follow below steps.

Right click on your project and go to properties and select start url and write your page url.

enter image description here

Hope it works

2
votes

You should not set the start-page on your view file, MVC is not like web-forms as you start the project it will go to http://localhost:9240/Home/Index by default if you do want to change that you either have to modify your Action Index to redirect to the action you want in controller or change the default routes.

1
votes

Aside from the default route, if you always want to launch from a specific page when debugging, you can set the "Start Action" of your web app by right clicking on the project, go to Properties -> Web -> Start Action, check the "Specific Page" radio button, and input the URL you wish to land on.

This can be helpful if you're working on a particular feature in a large web application, and you want to save yourself a few clicks every time you go to debug.

MSDN for reference : Change the Start Action for Application Debugging