在 ASP.NET MVC 中使用状态机工作流

发布于 2024-08-13 22:14:32 字数 152 浏览 3 评论 0原文

我有一个状态机工作流程,其中包含许多状态。每个状态都有一个处理外部事件的事件驱动活动。当该事件触发时,我想将请求重定向到不同的控制器操作视图

在状态机工作流程中触发事件时,重定向到不同视图或控制器操作的最佳方法是什么?

I have a state machine workflow which contains a number of states. Each state has an event driven activity that handles an external event. When that event fires, I'd like to either redirect the request to a different Controller Action or a View.

What is the best way to redirect to a different view or controller action when an event is fired in state machine workflow?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风流物 2024-08-20 22:14:32

您可以只使用 RedirectToAction 方法:
http://msdn.microsoft.com/ en-us/library/system.web.mvc.controller.redirecttoaction.aspx

一旦工作流确定需要执行什么操作,调用该方法,浏览器将被重定向,控制权将移至该操作。另一方面,如果你只需要呈现一个特定的视图,你可以使用控制器的 View 方法并传入你想要显示的视图的名称:
http://msdn.microsoft.com/ en-us/library/system.web.mvc.controller.view.aspx

You can just use the RedirectToAction method:
http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.redirecttoaction.aspx

Once your workflow determines what action needs to be executed, call that method and the browser will be redirected and control moved to that action. On the other hand, if you just need to present a specific view, you can just use the controller's View method and pass in the name of the view you want to show:
http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.view.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文