如何将 XML 数据传递到在 Web 浏览器控件中运行的网页?

发布于 2024-12-26 15:31:45 字数 166 浏览 1 评论 0原文

我有 Windows 应用程序,其中使用 Windows (.NET) 浏览器控件加载网页。 Windows应用程序需要向网页(aspx)发送一些信息,现在是使用查询字符串来实现的。

现在我们想要发送更多可能采用 XML 格式的详细信息。

在这种情况下我们如何传递大量数据(如XML)?

I have windows application in which web page is loaded using the windows (.NET) browser control. The windows application needs to send some information to the web page (aspx) and now it's achieved using query string.

Now we want to send more details which may be in the XML format.

How can we pass the large amount of data (like XML) in such case?

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

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

发布评论

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

评论(1

月寒剑心 2025-01-02 15:31:45

如果您想发送(更多)数据,您应该使用POST方法。 (这样,您实际上不需要关心它是 XML 还是其他内容,只要特定的表单可以正确处理它即可。)

查询字符串应该仅用于指定资源。通常,查询字符串与 GET 方法一起使用,例如 http://server/giveme.php?report&number=123。 (如果该字符串与浏览器一起使用,则应打开与 server:80 的连接并显示 GET /giveme.php?report&number=123。(然后是一些标头等)

POST 的使用非常相似,除了在方法、URI (/hereis.php?report&number=124) 和一些 HTTP 标头之后,还会发送数据(实际上可以是任何 。

另请记住,GET 应该仅用于查询:您可以调用 GET /giveme.php?report&number=123 一千次,您仍然应该得到相同的结果 报告编号 123(或某些更新版本)(因此 GET 不应用于发送数据,而应用于获取数据。)

对于 POST,这不是预期的:每次 POST来自你的被接受,你实际上将一些数据发送到服务器,通常您不应该多次执行POST /hereis.php?report&number=124(好吧,您可以设计。您的应用程序接受 POST /hereis.php?report,但这取决于您,这是另一个故事。)

If you want to send (more) data, you should use method POST. (That way you don't really need to care whether it's XML or something as long as the particular form can handle it correctly.)

Query string should be used only to specify the resource. Typically query string is used with GET method like http://server/giveme.php?report&number=123. (If that string is used with browser, it should open connection to server:80 and say GET /giveme.php?report&number=123. (Then some headers follow, etc.)

Use of POST is very similar except that after the method, URI (/hereis.php?report&number=124) and some HTTP headers, also data is sent (which can really be any data).

Also remember that GET is supposed to be used only for queries: you can call GET /giveme.php?report&number=123 a thousand times and you should still get the same report no. 123 (or some updated version). (So GET should not be used to send data, but to get data.)

For POST, this is not expected: Each time POST from you is accepted, you actually post some data to the server, and normally you should not get away with doing POST /hereis.php?report&number=124 multiple times. (Well, you can design your application to accept POST /hereis.php?report, but that's up to you and it's another story.)

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