使用 COM 将数组从 C# 返回到经典 ASP
我正在尝试使用 com 将数组从 C# 返回到经典 asp。 这篇文章对我帮助很大< /a>,但我仍然有问题:
我在 c# 中有以下方法:
public object[] returnStuff () {
return new object[] {'1','2','3'};
}
我的经典 ASP:
dim responseArray1
responseArray1 = RegusSoapComponent.returnStuff()
response.write("Type of Array one is " & VarType(responseArray1))
response.write("Type of Array one is " & responseArray1(1))
我的输出是:
response is Type of Array one is 8204
Microsoft VBScript 运行时错误“800a01ca”
变量使用 VBScript 不支持的自动化类型
无论我做什么,我似乎都无法访问此变量。
I am trying to return an array from c# to classic asp using com. This post helped me lot, but I still have problems:
I have the following method in c#:
public object[] returnStuff () {
return new object[] {'1','2','3'};
}
My classic ASP:
dim responseArray1
responseArray1 = RegusSoapComponent.returnStuff()
response.write("Type of Array one is " & VarType(responseArray1))
response.write("Type of Array one is " & responseArray1(1))
My output is:
response is Type of Array one is 8204
Microsoft VBScript runtime error '800a01ca'
Variable uses an Automation type not supported in VBScript
No matter what I do, I don't seem to be able to access this variable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VBScript 喜欢接收包含变体安全数组的变体。因此,您需要返回一个包装对象数组的对象。例如:
应该以正确的方式整理。请参阅详细版本的先前答案。
VBScript likes to receive a variant containing a safearray of variants. So you need to return an object wrapping your array of objects. eg:
which should get marshalled the right way. See a previous answer for the detailed version.