I just created a ASP.NET MVC project in VS2008.
When I press F5 to debug the current view in my browser, it open the URL of the ASPX file :
http://localhost/Views/MyController/Index.aspx
instead of :
http://localhost/MyController
How to make it open the good URL ?
If those URLs don't include a controller or action method name, then you can provide the missing information through default values on your routes. But if those URLs include an incorrect action or controller name, then ASP.NET MVC will simply return one of the standard HTTP error codes.
To debug a MVC solution:Under Debug > Choose Attach to process (Or ctrl + alt + p ) In the process list, choose the w3wp.exe or iisexpress.exe process (depending on your project type), and click attach. Wait for visual Studio to load all relevant symbols referenced by your project (this might take a while).
Open your project properties and make sure that the project is configured to connect to the correct Web server and launch URL. (Open Properties > Web > Servers or Properties > Debug depending on your project type.) If that does not work or you are debugging remotely, follow steps in Check your IIS Configuration.
You've got start action set to Current Page in the Web tab of the project properties.
Change it to Specific Page and leave the specific page text box blank.
Edit: from the comments attached to this answer we've established that what would be desirable is for VS to heursitically determine that given that the current page in the editor is "Views/Products/Index.aspx" we would like VS to start a debugging session at /Products.
This is too much to be asking of VS right now.
The alternative might seem to always be starting from the root and navigating in.
However you can edit the Specific Page text box to the path you'd like it to start. If you are debugging the above view then entering "Products" in the text box would probably be the closest you'd get to the goal.
You'd have to keep changing the content of the Specific Page text box each time you want to repeatedly test a different view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With