开发者

Post from one ASP.NET MVC site to another

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.


You could POST using a simple form:

<form method="post" action="http://othersite.com/controller/action">
    <!-- some input fields containing the values to post -->
    <input type="hidden" name="param1" value="value1" />
    <input type="submit" value="Post to other site" />
</form>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜