方法一:
1: RouteValueDictionary rv = new RouteValueDictionary();
2: rv.Add("Key", "value");
3: return RedirectToAction("Index", rv);
執行後網址如下:
http://localhost/Controller/Index?Key=value
方法二: (較簡單,使用匿名型別)
1: return RedirectToAction("Index", new { Key = "value" });
執行後網址如方法一相同:
http://localhost/Controller/Index?Key=value
沒有留言:
張貼留言