我有一个控制器:
public ActionResult Index(string id)
{
ViewBag.ReloadedFromEmailForm = id;
return View();
}
可以使用参数从 RouteConfig(作为其默认值)id = null
调用控制器,并且可以从返回的其他控制器调用
return RedirectToAction("Index", "Home", new {id = 1});
现在我想得到它,id = 1
但是当我打开应用程序时在我的 url 中设置,就像没有任何参数的常规一样。
如何做到这一点?
现在:localhost:8888/Index/1
我想要什么:(localhost:8888/Index/
但我仍然想填写 ViewBag)。