Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio ASP.NET MVC project: setting the start URL

Consider an ASP.NET MVC 2 project with VS 2010. The goal is to set the 'start URL' on run/debug using VS's built-in Cassini web server.

Entering the URL as I want to be loaded, in the typical & valid format, controller/action, VS 2010 gives this exception.

alt text

Tried Remedies:

  • starting the URL with and without a slash
  • ending the URL with and without a slash

Question: How can you specify the start URL for an MVC 2 project?

Technologies:

  • Visual Studio 2010
  • ASP.NET MVC 2

Resolution: I was using the wrong field in the startup options. What was needed was the "Specific Page" field with the relative URL, and not Start URL.

like image 314
p.campbell Avatar asked Dec 30 '09 19:12

p.campbell


People also ask

How do I change the default URL in MVC?

How do I change the default page in ASP NET MVC? You can set up a default route: routes. MapRoute( "Default", // Route name "", // URL with parameters new { controller = "Home", action = "Index"} // Parameter defaults ); Just change the Controller/Action names to your desired default.

How do I change the URL of a Visual Studio project?

In Solution Explorer, right-click the name of the web application and select Properties. Click the Web tab. In the Servers section, under dropdown selection for IIS Express, change the port number in the Project URL box. To the right of the Project URL box, click Create Virtual Directory, and then click OK.

Which is the startup page in MVC application?

Right-click your Project within the Solution Explorer. Choose Properties. Select the Web tab on the left-hand side. Under the Start Action section, define the Specific Page you would like to default to when the application is launched.


2 Answers

Start URL has to be a fully qualified URL and is not really used that often. It's meant for testing web services by opening a page that will call into the service, but isn't part of the application itself.

If you're just looking to start on a certain page of your application, which it sounds like you want, then use the "Specific Page" field, and enter your relative URL.

Here's the doc page on project start options.

like image 134
womp Avatar answered Oct 04 '22 02:10

womp


Use Start Page \ Specific Page -- NOT START URL -- and specify your URL without a slash.

That oughta do it for you.

like image 30
chakrit Avatar answered Oct 04 '22 00:10

chakrit