views:

24

answers:

1

Right now it always goes to default.aspx that subsequently opens the default controller but I would like to go directly to the controller I am editing when I hit the debug button.

A: 

Right click on the Web Site in Visual studio and select Property Pages. The Start Options section gives you flexibility as to which page loads first. You can choose and set the Start URL option to something like http://localhost:1324/Home/Index to force debugging sessions to default to the HomeController's Index action.

This requires two things to be true:

  1. 1234 is a static port used by the Cassini web server when debugging your pages (you can change this behavior by pressing F4 on the web site's project and setting the Use dynamic ports setting to false and the Port number field to a port of your choosing.
  2. The Web Site automatically starts up when you run the application from Visual Studio. Make sure it is by selecting the Property context menu item from the Solution's right click menu and editing the Common Properties -> Startup Project settings.

Alternatively, you can use the Use Current Page setting of the Start Options dialog. Developer beware though, as I'm not sure how MVC-aware this option is.

David Andres
I think s/he's asking how to start with a dynamic controller parameter, not always starting with Home/Index.
womp
@womp: Correct me if I'm wrong, but isn't that satisfied by changing the Start URL setting to some other action on some other controller?
David Andres
Sure - but then you have to go in and change the setting. I think he wants to be able to hit F5 and start up in the controller that he's currently editing, much like how the "Current Page" setting works for starting up regular asp.net sites.
womp
@womp: Could go either way from the OP. I don't know of a "smart" way to hit F5 with MVC pages, and this answer may be helpful to the poster even if it isn't as seamless as what you describe. Let's wait and see...
David Andres
womp was correct... I wanted a smart way of starting the controller I was editing and it doesnt seem like its possible... but the answer was at least informative..
NachoF
@NachoF: Cool. Would have been nice though.
David Andres