I have action method on my "CartController" an AddtoCart that returns an ActionResult. The problem I'm having is that I post from antoher controller to the AddtoCart the Id of the product i want to add, then move on. I have no problem with the validation; however, it's when I want to redirect to the View that called the Action when the !ModelState.IsValid, that I don't know who called me (or where to find it).
It is possible that several different controllers may post to the method. Is there something in the ViewData that I can use to findout who called my Action Method?
I don't think that controllers are making the post. Controllers are accepting the requests ( posts) and do some work, retrieve data and then choose which view to render back to the browser.
So, your action methods are normally called from web browser (link on the page, javascript). That is why I suggest you to pass additional parameter to the Action methods and then based on that value choose appropriate view to render back.
Hope that I understood well what is the nature of your problem...
I think you're after something like this:
from a related question about getting the view name from inside a controller method.
Sounds to me like you are after:
Let me know if you're not.
HTHs,
Charles