Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing querystrings to RedirectToRouteResult (beside controller and action)

I have the following code:

var routeDictionary = new RouteValueDictionary {{"action", "Login"}, {"controller", "Persons"}};
filterContext.Result = new RedirectToRouteResult(routeDictionary);

That will produce "/Persons/Login"

How can I pass an aditional querystring to the previous code? so that it produces "/Persons/Login/?someQuerystring=someValue"

like image 341
sports Avatar asked Jun 17 '13 14:06

sports


1 Answers

Try this:

filterContext.Result = new RedirectToRouteResult(
    new RouteValueDictionary {
        { "action", "login" },
        { "controller", "persons" },
        { "someQuerystring", "someValue" }
    }
);
like image 85
andreister Avatar answered Oct 14 '22 13:10

andreister