如何在asp classic中获取作为正文发布的值的内容?

发布于 2024-07-25 14:28:42 字数 1186 浏览 4 评论 0原文

我见过几个其余示例,其中 xml 消息发布在 http 请求的正文中,而不是发布在命名参数中...

在经典 asp 中,我有 request.form 对象,它允许我获取发布的值,但我必须指定参数的名称...

有什么方法可以获取帖子的全部内容吗?

我需要相当于

request.serverVariables("QUERY_STRING"),但对于帖子,而不是 http 请求的 get 部分...

( http://www.w3schools.com/ASP/coll_servervariables.asp

我必须使用 request.binaryRead() 吗???

非常感谢

ps:在java中,我冷地使用 request.getReader() 实现了这一点... 如何获取整个 http 帖子的值? 解析restful post

-

只是为了澄清一点,

当我说发布一个值作为正文时,我的意思是消息的内容不会像 param1=value1&param2=value2...paramx= 那样 进行编码valuex

消息是正文本身...您可以使用任何 ajax 库(如原型)来测试 ir 来实现此目的,我正在使用一个 firefox 插件,可以让您做到这一点,它的名称为 POSTER

https://addons.mozilla.org/en-US/firefox/addon/2691

用于与 Web 服务和其他 Web 资源交互的开发人员工具,可让您发出 HTTP 请求、设置实体主体和内容类型。 这允许您与 Web 服务交互并检查结果...

I've seen a couple of rest examples where the xml message gets posted in the body of the http request, and not in a named parameter...

in classic asp I have the request.form object that allows me to get the posted values, but I have to specify the name of the parameter...

is there some way to get the whole content of the post?

I would need the equivalent of

request.serverVariables("QUERY_STRING"), but for the post, not the get part of the http request...

( http://www.w3schools.com/ASP/coll_servervariables.asp )

would I have to use request.binaryRead()???

thanks a lot

ps: in java, I cold achieve this using request.getReader()...
how to get a the value of an http post as a whole? parsing restful post

--

just to clarify thing a little bit

when I say post a value as the body, I mean that the content of the message is not enconded like param1=value1¶m2=value2...paramx=valuex

the message is the body itself... you can achieve this with any ajax library (like prototype) to test ir I'm using a firefox plugin that let you do that, it's named POSTER

https://addons.mozilla.org/en-US/firefox/addon/2691

A developer tool for interacting with web services and other web resources that lets you make HTTP requests, set the entity body, and content type. This allows you to interact with web services and inspect the results...

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

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

发布评论

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

评论(3

李白 2024-08-01 14:28:42

您没有指定要发布的实际内容类型,也没有指定您在获得它后打算如何处理它。

让我们假设内容是 XML,并且您希望将其加载到 XML DOM 中。

关于 Request 对象的一个​​有用的事实是它实现了 IStream,其中流是 POST 的实体主体。 另一个有用的事实是 MSXML DOMDocument 加载方法可以接受 IStream 的实现。 因此:-

 Dim xml: Set xml = CreateObject("MSXML2.DOCDocument.3.0")
 xml.async = false
 xml.load Request

此代码将发布的实体主体加载到 DOM 中。

You didn't specify either what actual content type is being posted nor what you intented to do with it once you've acquired it.

Lets assume for a moment that the content is XML and you want to load it into an XML DOM.

A useful fact about the Request object is that it implements IStream where the stream is the entity body of the POST. Another useful fact is MSXML DOMDocument load method can accept an implementation of IStream. Hence:-

 Dim xml: Set xml = CreateObject("MSXML2.DOCDocument.3.0")
 xml.async = false
 xml.load Request

This code loads the posted entity body into the DOM.

迷雾森÷林ヴ 2024-08-01 14:28:42

我想我发现

如果你发出 str( request.form ) 你会得到表单元素的原始值...

也适用于 request.querystring 和 request.cookies

它不适用于 request.serverVariables ,抛出异常。 ..

哦,检查调试器时我还发现了一个完全未记录的属性 request.body,它的行为似乎就像 request.form 属性一样...

I think I found it

if you issue str( request.form ) you get the raw value of the form element...

works also with request.querystring and request.cookies

it doesn't work with request.serverVariables, throws an exception...

oh, and inspecting the debugger I've also found a completely undocumented property, request.body, that seems to behave just like the request.form property...

清引 2024-08-01 14:28:42

您是否试图循环遍历表单中的所有发布值? 如果是在 ASP.OLD 中,您可以这样做:

对于 Request.Form 中的每个字段

Are you trying to loop through all the posted values from the form? If so in ASP.OLD you could do this:

For Each Field in Request.Form

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