I was trying to execute RedirectToAction(actionResult) from my base controller but IntelliSense didn’t show this overload. I have found out RedirectToAction is placed into every T4MVC controller partial class. I kind of understand why it was implemented this way… but wouldn’t it be better to have an alternative implementation which would be an extension method to Controller? Or is there a better solution for my case?
I was trying to execute RedirectToAction(actionResult) from my base controller but IntelliSense didn’t show
Share
The difficulty is that the implementation of RedirectToAction needs to call Controller.RedirectToRoute, which is protected and not public. Hence you would not be able to call it from an extension method.
Another downside is that even if it worked, you’d then have to call
this.RedirectToAction(...)instead of justRedirectToAction(...).