我有以下代码:
var routeDictionary = new RouteValueDictionary {{"action", "Login"}, {"controller", "Persons"}};
filterContext.Result = new RedirectToRouteResult(routeDictionary);
这将产生“/Persons/Login
”
如何将aditional查询字符串传递给之前的代码?这样它就会产生“/Persons/Login/?someQuerystring=someValue
”
答案 0 :(得分:35)
试试这个:
filterContext.Result = new RedirectToRouteResult(
new RouteValueDictionary {
{ "action", "login" },
{ "controller", "persons" },
{ "someQuerystring", "someValue" }
}
);