Reputation: 9871
I have the following route configuration in place:
aRoutes.MapPageRoute("routePageA", "page/a", "~/Pages/A.aspx");
aRoutes.MapPageRoute("routePageB", "page/b", "~/Pages/B.aspx");
I have code in a click handler for A.aspx that is redirecting to B.aspx however I get different behaviour as follows:
When redirecting to the route without ending request:
Response.Redirect("/page/b");
the events fired are:
B.aspx Page_Load()
Response.Redirect("/page/b, true");
the events fired are:
B.aspx Page_Load()
Response.Redirect("/Pages/B.aspx");
the events fired are:
The behaviour I am expecting is 3. But why does this only behave this way when the ASPX is the redirection target. Can someone explain to me why directing to a route produces different behavior?
Upvotes: 0
Views: 804
Reputation: 212
You can use RedirectToRoute instead of Response.Redirect(). Try this instead.
return RedirectToRoute("routePageB");
Upvotes: 0