I am using c# .net mvc2 and I am new to this. I set up the project according the tutorials on asp.net, and everything works fine. However, I accidentally selected one of the views to be the start page, and now every time I debug, the .aspx page tried to
come up in the browser, but due to the lack of flow and routing, it errors out and I have to manually type the url every single time i debug the app.
My RegisterRoutes Method is still trying to get the Admin controller, but the debugger seems to be overridding that, or I am not sure what is happening. Please give any suggestions if you can.
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Admin", action = "Index", id = UrlParameter.Optional }
// Parameter defaults
);
}
That is because you have changed the default behaviour. Normally when you F5 or ctrl + F5 your ASP.NET MVC application there is no specific page set as the start action. In your case you have set a default page so you have changed this behaviour. Just pop-up
the project properties, in the Web tab and in the panel Start Action, clear the enty for Specific Page, save and try again.
Give a man a fish and you will feed him for a day. Teach a man to fish and you will feed him for a lifetime.
Marked as answer by priyeshj on Sep 07, 2010 09:59 PM
I wonder why nothing like this showed up while searching the forums. Maybe it is really basic knowledge, that is not apparent to newbies. Thanks again!
priyeshj
Member
1 Points
10 Posts
MVC2 start page reset
Sep 07, 2010 06:23 PM|LINK
Hi,
I am using c# .net mvc2 and I am new to this. I set up the project according the tutorials on asp.net, and everything works fine. However, I accidentally selected one of the views to be the start page, and now every time I debug, the .aspx page tried to come up in the browser, but due to the lack of flow and routing, it errors out and I have to manually type the url every single time i debug the app.
My RegisterRoutes Method is still trying to get the Admin controller, but the debugger seems to be overridding that, or I am not sure what is happening. Please give any suggestions if you can.
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Admin", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); }start page initial setup MVC2 RegisterRoutes
gabriel.loza...
Contributor
3583 Points
800 Posts
Re: MVC2 start page reset
Sep 07, 2010 07:12 PM|LINK
That is because you have changed the default behaviour. Normally when you F5 or ctrl + F5 your ASP.NET MVC application there is no specific page set as the start action. In your case you have set a default page so you have changed this behaviour. Just pop-up the project properties, in the Web tab and in the panel Start Action, clear the enty for Specific Page, save and try again.
priyeshj
Member
1 Points
10 Posts
Re: MVC2 start page reset
Sep 07, 2010 07:42 PM|LINK
Thank you!
I wonder why nothing like this showed up while searching the forums. Maybe it is really basic knowledge, that is not apparent to newbies. Thanks again!