-1
我正在处理这个服务器端的asp脚本。它应该从一个web应用程序接收一个xml流并将其保存在一个xml文件中。问题是我一直无法读取这个流。我使用了不同的方法,但似乎找不到合适的方法。另一件事是测试我使用休息控制台添加铬,它似乎工作没有问题,但是当我的客户端发送流我无法阅读它,他们收到代码500错误。从httprequest检索数据
起初我试图读取二进制模式流,然后将其转换
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
,然后当我尝试写崩溃转换的字符串
然后我切换到request.form
function readContent()
'writeInLogFile(Time & " " & URLDecode(Request.Form))
writeInLogFile(Time & Request.ServerVariables("ALL_RAW"))
readContent = URLDecode(Request.Form)
writeInLogFile(Time & " the length of the converted string is : "& len(readContent))
end function
但仍然通过休息控制台测试时,所有工作和实际接收来自我的客户端的流只是崩溃。
任何人都面临着类似的问题,或有一个想法,我怎么能解决这个事情提前
感谢
更新:
这里是解码功能
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(BytesToStr(b)中)'。但看看你在做什么,我会说这个问题是在'URLDecode()'函数中。 – Lankymart 2014-09-29 09:45:27
不,在URLDecode()函数中没有错误,就像我在本地测试(Rest控制台)时所说的,一切运行平稳,并且功能完美。 – bibo 2014-09-29 12:05:40
猜猜这没有问题,那么你显然知道你在做什么。祝你好运。 – Lankymart 2014-09-29 13:51:16