Pass an array from classic asp to .net

0

Friends, I need to pass an array from classic asp to a dll made in .net, and in .net I wait for a string type [], how the hell do I do to pass that data from classic asp? Today I do it like this:

Dim ws
dim arreglo(0)
Set ws = Server.CreateObject("Stc.ConsumoWS")
ws.SolicitarDesafio 3, 3, "", "00115594605", arreglo

I get this error:

Error de Microsoft VBScript en tiempo de ejecución error '800a000d' 

No coinciden los tipos /PruebaStc/Default.asp, línea 22
    
asked by Luis 17.04.2017 в 23:15
source

2 answers

0

The error occurs when no function or variable is declared. Check that you have added the explicit declaration of variables:

<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %> 

at the beginning of your ASP page in this case.

In .NET declares the variables with some initial value, to verify you would need to publish the .NET code here. But the error you indicate is from ASP.

    
answered by 26.06.2017 в 09:10
0

From what I've seen in this article of the MSDN, I think you have to do two things in your C # method

The signature of your C # method would look like this:

public void SolicitarDesafio(
    int p1, 
    int p2, 
    string p3, 
    string p4, 
    [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VT_BSTR)] ref string[] p5)

In ASP Classic, the array would be initialized like this:

Dim arreglo(2)
arreglo(0) = "valor 1"
arreglo(1) = "valor 2"

And the call would be how you put it:

Dim ws
Set ws = Server.CreateObject("Stc.ConsumoWS")
ws.SolicitarDesafio 3, 3, "", "00115594605", arreglo
    
answered by 26.06.2017 в 14:42