Routeconfig中有以下路线
routes.MapRoute(
name: "WithParams",
url: "{controller}/{action}/{langue}/{AffID} ",
defaults: new { controller = "Home", action = "Index", AffId = "", langue = "" }
);
我试图从系统的某个部分调用此路线。
Response.RedirectToRoutePermanent("WithParams", new RouteValueDictionary { AffId :123,langue:"EN" });
它给出了语法错误,我们如何在上面的重定向中传递查询字符串参数。
答案 0 :(得分:0)
试试这个:
return RedirectToRoutePermanent("WithParams", new { AffId = 123, langue = "EN" });
答案 1 :(得分:0)
试试这个:
Dictionary<string,string> dictionary = new Dictionary<string, string>();
dictionary.Add("AffId", "58");
dictionary.Add("langue", "EN");
Response.RedirectToRoutePermanent("WithParams", new RouteValueDictionary(dictionary));