2016-12-01 89 views
0

有一個在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

試試這個:

return RedirectToRoutePermanent("WithParams", new { AffId = 123, langue = "EN" }); 
0

試試這個:

Dictionary<string,string> dictionary = new Dictionary<string, string>(); 
     dictionary.Add("AffId", "58"); 
     dictionary.Add("langue", "EN"); 


     Response.RedirectToRoutePermanent("WithParams", new RouteValueDictionary(dictionary));