Return Array from C # to Classic ASP with COM

I am trying to return an array from C # to classic asp using com. This post helped me , 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 conclusion:

 response is Type of Array one is 8204 

Microsoft VBScript runtime error '800a01ca'

Variable uses automation type not supported in VBScript

No matter what I do, I seem to be unable to access this variable.

+4
source share
1 answer

VBScript likes to get an option containing saferray options. So you need to return an object wrapping your array of objects. eg:

 public object returnStuff() { return new object[] {'1','2','3'}; } 

which must be configured correctly. See previous answer for detailed version.

+4
source

All Articles