gpt4 book ai didi

asp-classic - MSXML2.ServerXMLHTTP 的默认内容类型是什么?

转载 作者:行者123 更新时间:2023-12-04 02:43:47 28 4
gpt4 key购买 nike

在我的previous question ,我不小心发送了带有 text/xml Content-Type 的 token /值对,导致没有发送任何内容。 Tim C 对这个问题的洞察力非常有帮助。再次感谢蒂姆!

回看原来的发送代码,我现在意识到将ServerXMLHTTP的Content-Type设置为text/xml是最近的错误添加。我在问题中发布的发送代码如下所示:

url = "www.receivingwebsite.com\asp\receivingwebpage.asp"
information = "UserName=Colt&PassWord=Taylor&Data=100"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/xml"
xmlhttp.send information

真正的发送代码是:

url = "www.receivingwebsite.com\asp\receivingwebpage.asp"
information = "UserName=Colt&PassWord=Taylor&Data=100"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.send information

...在发送前不尝试设置 Content-Type。

不幸的是,最初导致我寻求帮助的问题仍然存在。我的接收经典 ASP 页面看不到 ServerXMLHTTP 对象正在发布的信息。该信息不在请求对象的 querystringform 数组中。无论我做什么,我都找不到信息,但我知道它正在发送,因为当我将内容类型更改为 application/x-www-form-urlencoded 时,我可以看到它在 request.form 数组中。

MSXML2.ServerXMLHTTP 类的默认内容类型是什么?

当发送类使用默认内容类型时,我的信息在哪里?

最佳答案

如果 POST 的内容类型是“application/x-www-form-urlencoded”,ASP 只会填充表单数组。通常 ServerXMLHTTP 不会设置内容类型 header ,因此如果您不手动设置,则不会发送内容类型 header 。

一个异常(exception)是您传递 XML 文档作为要发送的参数,在这种情况下,ServerXMLHTTP 会将内容类型设置为“text/xml;charset=UTF-8”。

关于asp-classic - MSXML2.ServerXMLHTTP 的默认内容类型是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/372030/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com