0

i'm calling a C# com interop dll from classic asp.

i want to send name value pairs to the c# dll.

tried using dictionary object in classic asp and accepting it using the same dictionary object (scripting.runtime com reference) in C#.

But it gives Invalid procedure call or argument error.

I got this idea of using scripting.dictionary from this link http://www.eggheadcafe.com/community/aspnet/2/10016705/is-there-any-way-to-pass-a-dictionary-object-to-c.aspx

may be im missing something

Questions

  1. am i missing something or is there a better way to pass key value pairs from Classic asp to C#.
  2. i'm also considering using this library asp3tojson and deserializing in C#. is it too complicated?
Kul-Tigin
  • 16,728
  • 1
  • 35
  • 64
Vivek Chandraprakash
  • 1,165
  • 2
  • 21
  • 54

2 Answers2

1

I'd convert it to JSON. At least to know there are no object-level interoperability problems, especially when it comes to mixing in various MS objects.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
1

Hi. It's possible to use System.Collections.HashTable (and many other from mscorlib) within asp classic applications.
Try the following. Hopefully useful.
Asp App:

Option Explicit
Dim Dictionary, objNetCom, i

Set Dictionary  = Server.CreateObject("System.Collections.HashTable")
Set objNetCom   = Server.CreateObject("MyTest.doTest")

With Dictionary
    For i = 65 To 90
        .Add Chr(i), i 
    Next
End With
Response.Write objNetCom.getDictType(Dictionary) 

Set Dictionary  = Nothing
Set objNetCom   = Nothing

a c# Com Visible:

using System;
using System.Collections;

namespace MyTest
{
    public class doTest
    {
        public string getDictType(Object tDict)
        {
            return String.Format("Type : \"{0}\", Count : {1}", ((Hashtable)tDict).GetType().ToString(), ((Hashtable)tDict).Count);
        }
    }
}
Kul-Tigin
  • 16,728
  • 1
  • 35
  • 64