.Net MVC Call a controller from another controller with IOC

Sometimes you might want to invoke another controller action from a controller, here’s how you do it (Assuming you’re using some sort of IOC)

   var controller = DependencyResolver.Current.GetService<YourController>();

Leave a Reply

Your email address will not be published. Required fields are marked *