.NET MVC Call method on different controller

user135498 picture user135498 · Aug 18, 2009 · Viewed 83.8k times · Source

Can anybody tell me how to call a method on a different controller from within an action method? I don't want to redirect. I want to call a method on a different controller that returns a string and use the response within my action method.

Answer

Pete picture Pete · Aug 20, 2009

Sounds in my ears like you should refactor your application, and extract the functionality that generates the string out to a new seperate class (or reuse an existing class, if you have one that fits) and let both controllers use that class.