I have a route in my MVC3 project that works perfectly fine locally when run through the debugger and through IIS7. However, our servers are IIS6 and when I move my application out I am getting a "The page cannot be found" error. My guess is it has to do with the decimal in the route..
So I have tried implementing a RouteHandler which seems to be getting called but is not working correctly because the value isn't overwritten in the route?
Anyway, here is my route:
var route = context.MapRoute(
"Management_version",
"Management/Version/{versionNumber}/{action}",
new { area = "Management", controller = "Version", action = "View" },
new[] { "FRSDashboard.Web.Areas.Management.Controllers" }
);
route.RouteHandler = new HyphenatedRouteHandler();
and my route handler:
public class HyphenatedRouteHandler : MvcRouteHandler
{
protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var versionNumberContext = requestContext.RouteData.Values["versionNumber"];
requestContext.RouteData.DataTokens["versionNumber"] = versionNumberContext.ToString().Replace(".", "-");
return base.GetHttpHandler(requestContext);
}
}
Basically, I am trying to replace the decimal point with a hyphen to work around the issue. Any suggestions would be greatly appreicated.
So it turns out that I also needed to set a Wildcard application map for "aspnet_isapi.dll" in addition to the application extension wildcard. Both wildcards must have the "verify that file exists" option unchecked.