I am working on a Web Forms Web Application with mixed in MVC. I have followed the instructions from this page http://www.packtpub.com/article/mixing-aspnet-webforms-and-aspnet-mvc and it works fine in VS2010 developer server but when I try to publish it to a MVC enabled IIS 6 browser is not automatically redirect to default.aspx after login and I get a 404 error at the root of the application.
My Global.asax.cs looks like this:
protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
}
If I comment out the call to RegisterRoutes in Application_Start method the automatic redirect to default.aspx works but then the MVC parts fail.
I need some help with how to setup the routing to enable automatic redirect to default.aspx while enabling the MVC routing. The MVC parts is located under a specific path like so: myserver/applicationname/mvcparts.
Asp.Net MVC 3 is installed on both developer machine and server where I publish.
That's because IIS6 doesn't support extensionless urls by default. You will need to configure it. And if you are not using ASP.NET 4, this is for you. If you don't configure it; IIS6 doesn't know that
/Home/Indexmust be associated with theaspnet_isapifilter. It doesn't even know that this is an ASP.NET application. That's the reason why in classic WebForms, they used the.aspxextension which is associated with the aspnet_isapi filter when you install .NET.Extensionless urls are supported by IIS7+ out-of-the-box when running in integrated pipeline mode.