I took my Lambda based RedirectToAction solution I previously blogged about and updated it to work against the Preview 3 bits. I also took the liberty to fix the bug where you couldn't actually call another controller's action. Some notable changes in the source, is that ActionRedirectResult is no more - as it's replaced with RedirectToRouteResult. I think this was a good consolidation between RedirectToAction and RedirectToRoute since they basically do exactly the same thing. You'll also notice that there are 3 more extension methods, which was necessary to fix the prior bug. Now, you can write code like
1: // for actions off of the current controller
2: return this.RedirectToAction(c => c.Login());
3: return this.RedirectToAction(c => c.Login("matt"));
4:
5: // alternatively, within the UserController you can do the following
6: return this.RedirectToAction<ProductController>(c => c.View(102));
I'm not going to post the entire code sample as you can download it here. Enjoy it, and let me know of anything else you'd like to see.

Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5