Working with State Machine Workflows in ASP.NET MVC
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 wh开发者_StackOverflow社区en an event is fired in state machine workflow?
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
精彩评论