HighTechTalks DotNet Forums  

Handling System._ComObject

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Handling System._ComObject in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Varun Singal
 
Posts: n/a

Default Handling System._ComObject - 07-07-2003 , 10:05 AM






Hi

I am calling .NET components from my Classical ASPs.
For this I strong named my assemblies, then registered them in the resistry
( using RegAsm), and put them in GAC (using GacUtil) .
Everything worked fine and my ASPs were able to call and use them.

The problem comes when my ASP code assigns an ASP object variable to a
property of a class in the assembly like:
oDotNetObject("Name") = Request("Name")
( where oDotNetObject is a class in my registered assembly )

The COM Callable Wrapper sends it as System._ComObject to .NET Runtime which
then throws exception as nothing is allowed on System._ComObject. On the
other hand, passing it as Variant solves the problem.
Dim varName = Request("Name")
oDotNetObject("Name") = varName

But this would require a significant change in my ASP pages. I want to
modify only my .NET components. Is there any way I can use this
System._ComObject in my managed code or any way I can make CCW to handle it.
I was trying to use System.Runtime.InteropServices.Marshal namespace to use
the System._ComObject I have not been able to do it.

Thanks in anticipation
Varun



Reply With Quote
  #2  
Old   
Mark Hurd
 
Posts: n/a

Default Re: Handling System._ComObject - 07-07-2003 , 11:52 AM






Varun Singal wrote:
Quote:
oDotNetObject("Name") = Request("Name")
Have a look at TypeName(Request("Name")) and you'll see you haven't got a
string yet.

You'll need to manually refer to the default value of the IStringList class or
just use CStr(Request("Name")).

Unless, of course, you want to enumerate each Name value in .NET when the URL
is ...?Name=one&Name=Two&Name=Three
in which case you'll want to inform .NET of the IStringList interface.
--
Regards,
Mark Hurd, B.Sc.(Ma.) (Hons.)




Reply With Quote
  #3  
Old   
Mark Hurd
 
Posts: n/a

Default Re: Handling System._ComObject - 07-07-2003 , 01:08 PM



Varun Singal wrote:
Quote:
Thanks Mark

But here my problem is that I am working on a huge application and I cant
change this usage in ASP files.
So I have to find a solution in .Net component -- as you said -- I will have
to inform .NET of the IStringList interface.
Any ideas about that!
A simple approach may be to access these values in a module with Option Strict
Off and then use late binding.

Option Strict Off

....
SomeString = IncomingComObj.Item

--
Regards,
Mark Hurd, B.Sc.(Ma.) (Hons.)




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.