views:

37

answers:

2

Is it possible to post a form from one MVC site so that it invokes the POST action in a controller on another site ? I can do a GET easily, but a browser redirect is always a GET as per my understanding and I am unable to invoke the target site's POST action.

e.g. http:/siteA.com/test invokes http://siteB.com/result/signin ... in the ResultController, the Get version of the "SignIn" action gets invoked, but I need the "Post" version to be invoked as I need to pass in parameters in the POST header.

Currently I am resorting to using a GET and am passing params. using the query string which is not ideal for my scenario. Any help here would be appreciated.

+2  A: 

You could POST using a simple form:

<form method="post" action="http://othersite.com/controller/action"&gt;
    <!-- some input fields containing the values to post -->
    <input type="hidden" name="param1" value="value1" />
    <input type="submit" value="Post to other site" />
</form>
Darin Dimitrov
I don't want the data that I am passing from siteA to siteB to be visible when the user does a "view source" in the browser.
Cranialsurge
Two possibilities: encrypt it or perform a server side POST request but in this case you won't be able to redirect the user to the resulting page.
Darin Dimitrov
A: 

I used AJAX to invoke the target and bundled in the necessary parameters to post in there.

Cranialsurge