Tuesday, 15 March 2011

asp.net mvc - How to specify a RedirectToRouteResult -



asp.net mvc - How to specify a RedirectToRouteResult -

my existing mvc code contains action routine this:

[httppost] public actionresult register1(someviewmodel model) { homecoming redirecttoaction("register", new { p = model.pagenumber - 1 }); }

i want move code library routine:

public static actionresult processpost(controller controller, string action, int pagenumber) { // redirect specified action on specified controller homecoming new redirecttorouteresult( <something here> ); }

and phone call action routine this:

return processpost(this, "register", model.pagenumber);

can kind person give me <something here> code yields actionresult redirects specified action (specified string argument) on specified controller (specified controller argument?

taking @ documentation on redirecttorouteresult seems pretty straight forward:

var routevalues = new routevaluedictionary(); routevalues.add("action", action); routevalues.add("controller", controller.gettype().name); routevalues.add("pagenumber", pagenumber); var result = new (redirecttorouteresult(routevalues);

asp.net-mvc

No comments:

Post a Comment