asp.net - The controller for path '/default.aspx' was not found or does not implement icontroller after upgrading from MVC1 to MVC2 -
i upgraded asp.net project mvc1 mvc2 in visual studio 8 , .net3.5 following instruction https://docs.microsoft.com/en-us/aspnet/whitepapers/aspnet-mvc2-upgrade-notes. there no compile errors when ran application, got "the controller path '/default.aspx' not found or not implement icontroller" exception. before upgrading mvc2 working well.
this default.aspx:
<script runat="server"> protected override void oninit(eventargs args) { var httpcontext = httpcontext.current; httpcontextbase contextwrapper = new httpcontextwrapper(httpcontext); var routedata = getroutedata(contextwrapper); var httphandler = routedata.routehandler.gethttphandler(new requestcontext(contextwrapper, routedata)); httphandler.processrequest(httpcontext); } private static routedata getroutedata(httpcontextbase context) { return routetable.routes .select(route => route.getroutedata(context)) .firstordefault(routedata => routedata != null); }
and these codes add routes:
routetable.routes.ignoreroute("{resource}.axd/{*pathinfo}"); routetable.routes.ignoreroute(" { *favicon }", new {favicon = @"(.*/)? favicon.ico(/.*)?"}); routetable.routes.routeexistingfiles = false; // elmah handles elmah routetable.routes.ignoreroute("elmah.axd"); // add default route routetable.routes.maproutelowercase( "default", "{controller}/{action}/{id}", new { controller = "user", action = "index", id = string.empty });
i tried find online, none of solutions found online fixed issue.
thank in advance.
Comments
Post a Comment