19

我有以下代码:

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

那将产生“ /Persons/Login

如何将附加查询字符串传递给前面的代码?使其产生“ /Persons/Login/?someQuerystring=someValue

4

1 回答 1

42

试试这个:

filterContext.Result = new RedirectToRouteResult(
    new RouteValueDictionary {
        { "action", "login" },
        { "controller", "persons" },
        { "someQuerystring", "someValue" }
    }
);
于 2013-06-17T15:05:10.263 回答