Last post Jun 13, 2015 01:08 PM by AGodinho
Jun 11, 2015 09:44 AM|AGodinho|LINK
I tryed to make what I thoughted to be a easy Routing, but it seams I'm doing it wrong...
I'm trying to turn something like this:
<rewrite url="~/Login.aspx" to="~/Autenticacao/Login.aspx" />
RouteTable.Routes.MapHttpRoute("Login", "Login.aspx", "~/Autenticacao/Login.aspx");
And when I try to access to /Login.aspx , I get this error:
No HTTP resource was found that matches the request URI 'http://localhost:10655/Login.aspx'.
No route providing a controller name was found to match request URI 'http://localhost:10655/Login.aspx'
Do I need to add the routes inside the Application_Start? I've a flag inside a session, at Global.asax, on event Session_Start, if that flag isn't active it adds the routes, so this is donne one time.
Jun 11, 2015 10:25 AM|PatriceSc|LINK
It seems you would need rather MapPageRoute. You want to keep the ASPX extension? You perhaps have to disallow physical file checking if doing that. See
http://www.codeproject.com/Tips/698666/USE-OF-MapPageRoute-Method-IN-ASP-NET-WEBFORM-ROUT (try also perhaps without the .aspx extension for a start).
Jun 11, 2015 12:09 PM|AGodinho|LINK
Thanx for your answer.
I want to keep the aspx extension cause I meant to do this for all aspx files.
I've disabled the physical file checking but this doesn't work.
RouteTable.Routes.MapHttpRoute("Login", "Login.aspx", "~/Autenticacao/Login.aspx", false);
I only find examples with regex, arguments and I don't seam to be able to find simple ReWrite examples with Routing....
Jun 11, 2015 12:41 PM|PatriceSc|LINK
But you are still using MapHttpRoute (Web API) rather than MapPageRoute (Web Forms). I gave a quick try at :
RouteTable.Routes.MapPageRoute("Testing", "some.aspx", "~/WebForm1.aspx");
and it worked fine (also the error message gave a hint as it is looking for a controller).
Jun 13, 2015 01:08 PM|AGodinho|LINK
Thanks. That solved the issue.