Hi.
I mixing projet aspx website with mvc application but my global asax don't routing correctly.
The global asax understanding that the route mvc don't is one
And then return the application return erro 404.
I revised the global asax and webconfig! But i could not solve.
Help me please. Tnks
Code global asax:
<script RunAt="server">
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
routes.IgnoreRoute("{resource}.ascx/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
ixicaio
0 Points
3 Posts
Mixing website ASPX With MVC application
Aug 07, 2012 08:43 PM|LINK
Hi.
I mixing projet aspx website with mvc application but my global asax don't routing correctly.
The global asax understanding that the route mvc don't is one
And then return the application return erro 404.
I revised the global asax and webconfig! But i could not solve.
Help me please. Tnks
Code global asax:
<script RunAt="server">
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
routes.IgnoreRoute("{resource}.ascx/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
void Application_Start(object sender, EventArgs e)
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
</script>
bcanonica
Contributor
3082 Points
595 Posts
Re: Mixing website ASPX With MVC application
Aug 07, 2012 08:49 PM|LINK
I would follow this tutorial it really helped me when trying to do a MVC and web forms hybrid.
http://weblogs.asp.net/rajbk/archive/2010/05/11/running-asp-net-webforms-and-asp-net-mvc-side-by-side.aspx
Thanks,
BC
Blog Void Impossible