带参跳转其他controller

public class GoToOtherController : Controller
{
    public ActionResult Index()
    {
        var vm = new GetValueFromOtherViewModel
        {
            Value="123"
        };
        TempData["GetValueFromOther"] = vm;
        return RedirectToAction("Index", "GetValueFromOther");
    }
}
public class GetValueFromOtherController : Controller
{
    public ActionResult Index()
    {
        var v = TempData["GetValueFromOther"] as GetValueFromOtherViewModel;
        return Json(v.Value,JsonRequestBehavior.AllowGet);
    }
}
public class GetValueFromOtherViewModel
{
    public string Value { get; set; }
}

参考资料

https://stackoverflow.com/questions/44958888/redirect-in-a-net-api-action-filter

转载于:https://www.cnblogs.com/Lulus/p/10040493.html

你可能感兴趣的:(带参跳转其他controller)