控件是否可以盲目代理另一个 URL,包括 PostBack?

发布于 2024-10-09 15:51:33 字数 326 浏览 1 评论 0原文

是否可以有一个控件将请求代理到另一个域/网站,包括回发?

在此控件中,您可以指定要执行的 URL,并且每当执行该控件时,它都会向另一个 URL 发出 GET 请求,并呈现 HTML 返回。 (这部分并不难。)

但是,当页面回发时,它将向另一个页面发出 POST 请求,其所有回发变量都完好无损。

我真的正在寻找一个盲代理。某些控件将接受传入请求并向其抛出另一个 URL,然后呈现结果。另一个页面真的不知道它没有与人类交互。

我想我可以开发这个,但我不可能是第一个想做这件事的人,所以谷歌没有向我透露解决方案一定是有原因的。我怀疑我会遇到其他有这个想法的人遇到的同样的大问题。

It is possible to have a control that would proxy requests to another domain/Web site, including postback?

In this control, you would specify the URL you wanted to execute, and whenever the control executed, it would make a GET request to this other URL, and render the HTML return. (This part is not hard.)

However, when the page is posting back, it would make a POST request, with all of its postback variables intact, to this other page.

I'm really looking for a blind proxy. Some control that will take the incoming request and throw it another URL, and render the results. The other page would really have no idea it wasn't interacting with a human.

I want to think I could develop this, but I can't be the first person who wants to do it, so there has to be some reason why Google isn't revealing the solution to me. I suspect I'm going to run into the same Big Problem that anyone else with this idea has run into.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我一直都在从未离去 2024-10-16 15:51:33

我不太确定这个的价值是什么;这可能就是您尚未找到解决方案的原因。

然而,在我看来,有两种可能的解决方案。

  1. 当页面呈现时,让控件修改表单操作以指向其他地方;或者,
  2. 在回发时,让控件使用 post 变量对备用 URL 执行 Web 请求,并决定当时如何处理结果。

I'm not exactly sure what the value of this is; which is probably why you haven't found a solution yet.

However, it seems to me that there are two possible solutions.

  1. When the page is rendered have the control modify the form action to point elsewhere; or,
  2. on post back, have the control execute a web request to the alternate URL with the post variables and decide what to do with the results at that time.
递刀给你 2024-10-16 15:51:33

最终,这从来没有多少发挥作用的机会。我尝试了一段时间,但是回发需要对控件树有深入的了解,并且您不可能将回发从调用页面应用到另一个页面并使其正确覆盖,因为控件两个页面之间的树完全不同。

现在,如果您想将后端应用程序编写为更传统的 Web 应用程序(甚至不是 ASP.Net 中的应用程序),它可能会起作用。在回发期间,您可以迭代 Request.Form 值并将它们发回,然后让您的后端应用程序准备好接受这些传入值并处理它们,但这不是传统的回发。

In this end, this never had much of a chance of working. I experimented with it for a while, but Postback requires intimate knowledge of the control tree, and there's no way that you're going to be able to apply a postback from the calling page to the other page and have it overlay correctly because the control trees between the two pages are totally different.

Now, if you wanted to write the backend app as a more traditional Web app (even something not in ASP.Net), it might work. During postback, you could iterate the Request.Form values and send them back, and just have your backend app prepared to accept those incoming values and deal with them, but this wouldn't be a traditional postback.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文