Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vbscript 从httprequest检索数据_Vbscript_Asp Classic_Request - Fatal编程技术网

Vbscript 从httprequest检索数据

Vbscript 从httprequest检索数据,vbscript,asp-classic,request,Vbscript,Asp Classic,Request,我正在处理这个服务器端asp脚本。它应该从web应用程序接收xml流并将其保存在xml文件中。问题是我无法读取此流。我用了不同的方法,但似乎找不到合适的方法。另一件事是为了测试,我正在使用rest控制台插件进行chrome,它似乎可以正常工作,但当我的客户端发送流时,我无法读取它,他们收到一个代码500错误 起初,我尝试以二进制模式读取流,然后将其转换 function readContent() dim a,b a=Request.TotalBytes b=Request.Bina

我正在处理这个服务器端asp脚本。它应该从web应用程序接收xml流并将其保存在xml文件中。问题是我无法读取此流。我用了不同的方法,但似乎找不到合适的方法。另一件事是为了测试,我正在使用rest控制台插件进行chrome,它似乎可以正常工作,但当我的客户端发送流时,我无法读取它,他们收到一个代码500错误

起初,我尝试以二进制模式读取流,然后将其转换

function readContent()
  dim a,b
  a=Request.TotalBytes
  b=Request.BinaryRead(a)
  writeInLogFile(" ")
  writeInLogFile(Time & Request.ServerVariables("ALL_RAW"))
  writeInLogFile(Time & " Data read in binary mode with a size of " & a)
  readContent = URLDecode(BytesToStr(b))
  writeInLogFile(Time & " the length of the converted string is : "& len(readContent))
end function
但这是我一直在日志文件中看到的

17:12:10Content-Length: 8416 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Authorization: Basic Host: User-Agent: Jakarta Commons-HttpClient/2.0.2 17:12:10 Data read in binary mode with a size of 8416 17:12:10 Converting binary to string 但是,当通过rest控制台进行测试时,一切正常,当从我的客户机实际接收到流时,它就崩溃了

任何人都面临类似的问题,或者有想法如何解决这个问题

提前谢谢

更新:

这里是解码功能

FUNCTION URLDecode(str)
  '// This function:
  '// - decodes any utf-8 encoded characters into unicode characters eg. (%C3%A5 = å)
  '// - replaces any plus sign separators with a space character
  '//
  '// IMPORTANT:
  '// Your webpage must use the UTF-8 character set. Easiest method is to use this META tag:
  '// <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  '//
  Dim objScript
  Set objScript = Server.CreateObject("ScriptControl")
  objScript.Language = "JavaScript"
  URLDecode = objScript.Eval("decodeURIComponent(""" & str & """.replace(/\+/g,"" ""))")
  Set objScript = NOTHING
  'writeInLogFile(Time & " the length of the converted string is : "& len(URLDecode))
END FUNCTION
函数URLDecode(str) “//此函数: “//-将任何utf-8编码字符解码为unicode字符,例如(%C3%A5=å) “//-将任何加号分隔符替换为空格字符 '// “//重要: “//您的网页必须使用UTF-8字符集。最简单的方法是使用此元标记: '// '// Dim对象脚本 设置objScript=Server.CreateObject(“ScriptControl”) objScript.Language=“JavaScript” URLDecode=objScript.Eval(“decodeURIComponent(“&str&”“。replace(/\+/g,”“”))) Set objScript=NOTHING 'writeInLogFile(时间&“转换字符串的长度为:”&len(URLDecode)) 端函数
客户端说要发送的编码与流实际发送的编码不同


Request.Form就是答案。

您缺少相关代码,这两个函数的源代码是什么样的<代码>URLDecode(BytesToStr(b))。但是看看你想做什么,我会说问题出在
URLDecode()
函数中。没有,URLDecode()函数中没有错误,就像我在本地测试(Rest控制台)时所说的那样,一切都运行顺利,函数工作正常。我想没有问题,你显然知道你在做什么。祝你好运。这就是问题所在。当我的客户端发送流时,这件事仍然不起作用,他们仍然收到代码500服务器错误。什么是
500内部服务器错误
,它是否有描述并指向有问题的行?
FUNCTION URLDecode(str)
  '// This function:
  '// - decodes any utf-8 encoded characters into unicode characters eg. (%C3%A5 = å)
  '// - replaces any plus sign separators with a space character
  '//
  '// IMPORTANT:
  '// Your webpage must use the UTF-8 character set. Easiest method is to use this META tag:
  '// <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  '//
  Dim objScript
  Set objScript = Server.CreateObject("ScriptControl")
  objScript.Language = "JavaScript"
  URLDecode = objScript.Eval("decodeURIComponent(""" & str & """.replace(/\+/g,"" ""))")
  Set objScript = NOTHING
  'writeInLogFile(Time & " the length of the converted string is : "& len(URLDecode))
END FUNCTION