MVC routing not working for non-default controller / root in virtual directory
I am using the default "ASP.NET MVC 2 Web Application" in IIS (which I do not have administrator access to) and for now I can go to
"server / ITEC"
I can't go to "server / ITEC / About" without returning the server, 404 error.
I also use RouteDebugger for testing - when I use the default "server / ITEC" it matches (as does the default home / index controller action), but when I manually type "server / ITEC / About" I don't know, t even see the RouteDebugger page. Also, note that when I put my index.html file in "server / Itec / About", it returns results, which makes me think the directory is configured to use the filesystem and not MVC routing when handling requests - this is a safe assumption ?
How do I update the Global.asax file so that I can return non-default controllers / actions? Or is it a server issue and how can I fix it?
Thank!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace mikeProg
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
}
}
}
source to share