本文介绍了如何POST数据到另一个Web应用程序(跨域)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请考虑以下情形,

有两个Web应用程序程序App1和放大器; APP2。用户将提交一份关于App1的虽然是形成他的信息。上App1的一个特定的按钮/链接的点击,同样的数据应张贴在页面上App2的,用户也应该被重定向到App2的同一页面。

我想找出实现这一功能的最好办法一定的帮助。

一,我已经尝试了是在运行时创建一个临时的HTML表单,设置形式向App2的页面的action属性并获得通过发布使用javascript提交表单的办法。该数据可以App2的页面上使用response.form对象获取。

此方法效果很好,但我仍想知道是否有实现所需功能的任何其他方式。

我真的appriciate,如果你可以给使用的RESTful Web服务来实现这一点,否则,使用一些的HttpModule在App1的拦截请求和修改重定向响应APP2,或者你可能会发现适合于目的的任何其他方式的一些见解

编辑:
使用查询字符串心不是一个选项,我。


解决方案

The way I have Implemented is by creating a custom control which would have a configurable property containing the URL to post data and another one accepting a dictionary object as the data input to be posted.

This control would internally create a HTML form with action attribute set to the URL specified by the user and have the data feilds created out of the dictionary object. This form would then be posted on the button click event on the page hosting this control.

这篇关于如何POST数据到另一个Web应用程序(跨域)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:26
查看更多