gpt4 book ai didi

asp.net-mvc - 来自基本 Controller 的 RedirectToAction

转载 作者:行者123 更新时间:2023-12-04 18:19:30 24 4
gpt4 key购买 nike

我试图执行 RedirectToAction(actionResult)来自我的基本 Controller ,但 IntelliSense 没有显示此过载。我发现 RedirectToAction 被放置在每个 T4MVC Controller 部分类中。我有点理解为什么它是这样实现的......但是有一个替代实现会是 Controller 的扩展方法不是更好吗?或者我的情况有更好的解决方案吗?

最佳答案

如果你

kind of understand why it was implemented this way...



然后你可以在你的基本 Controller 中以同样的方式实现它,你很高兴
    private ActionResult RedirectToAction(ActionResult actionResult)
{
var callInfo = actionResult.GetT4MVCResult();
return RedirectToRoute(callInfo.RouteValueDictionary);
}

关于asp.net-mvc - 来自基本 Controller 的 RedirectToAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10971555/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com