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.
views:
24answers:
1
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:
- 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.
- 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
2009-09-14 16:58:52
I think s/he's asking how to start with a dynamic controller parameter, not always starting with Home/Index.
womp
2009-09-14 17:00:18
@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
2009-09-14 17:01:29
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
2009-09-14 17:02:54
@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
2009-09-14 17:14:29
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
2009-09-14 18:41:53
@NachoF: Cool. Would have been nice though.
David Andres
2009-09-14 18:43:29