What are the ways to invoke an action in a controller?And Why? RRS feed

  • Question

  • I was asked this question in interview.Later  I found only one way: 
    var controller = DependencyResolver.Current.GetService<ControllerB>();
    controller.ControllerContext = new ControllerContext(this.Request.RequestContext, controller);
    from Stack overflow. Are there more ways? Also I need scenario for calling another controller action. Please help.
    Thursday, September 26, 2019 11:50 PM

All replies

  • Hi kobosh3, 

    Thank you for posting here.

    According to your description, your issue is more related to ASP.NET. Therefore, it will be more appropriate to ask your question in ASP.NET Forums.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, September 27, 2019 1:34 AM