Link to home
Start Free TrialLog in
Avatar of whatsit2002
whatsit2002Flag for United States of America

asked on

ASP.NET and Server.CreateObject

I understand that Server.CreateObject has been replaced in ASP.NET. My problem is that I run a login/user management system with a third party object called ASPCrypt like this:
Set Cryptor = Server.CreateObject ("AspCrypt.Crypt")

In .NET, I have tried:
<%@ Import Namespace="AspCrypt" %>

but I keep getting errors like:
BC30466: Namespace or type 'AspCrypt' for the Imports 'AspCrypt' cannot be found.

The Server.CreateObject method works perfectly on the same machine using classic ASP. What do I have to do to get the AspCrypt object to work/import with .NET?

-Whatsit2002
ASKER CERTIFIED SOLUTION
Avatar of naveenkohli
naveenkohli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of whatsit2002

ASKER

I'm not using an IDE... I'm writing asp.net code in Homesite 4.5x

Also, could you give an example of tlbimp?
Avatar of thomasdodds
thomasdodds

"I'm writing asp.net code in Homesite 4.5x" - then you've cut yourself off from the benefits of using the tool created for the feature rich framework you've decided to use for development ...
Well, if I could afford a multi-hundred dollar development environment, I might think about it, but I have had great success building classic asp with Homesite ($50 US).

Anyway, that's off topic.

I ran tlbimp on my AspCrypt.dll, created my RCW dll file and got the message:
AspCrypt imported

--- but, I still can't access the namespace. I keep getting the same errors. Can anyone help?

-Whatsit2002
"but I have had great success building classic asp with Homesite ($50 US)." - classic ASP and ASP.NET are so different; don't be fooled by the name ... either get VS.NET (if you have a student ID get the acedemic version) or get the free WebMatrix ... the framework is too rich to not use the proper tool ... if you are going to use Homesite, then write your project in classic ASP and forget .NET for now
Okay, so I didn't know about Web Matrix. I downloaded it, it look pretty usefull.

That's out of the way. Could someone please tell me how I might get my COM object working? (Either with Web Matrix or manually?)

I don't mean to come off as a stuck-up, but my concern is not my development environment. I have ported a lot of my asp to asp.net already. My one problem is this AspCrypt COM object and getting it to work with ASP.Net.

I would use ASP.Net's built-in crypto/MD5 stuff, but it is not compatible with the user info I already have since AspCrypt spits out a string and ASP.Net's md5 namespace spits back a binary chunk of data.

I'll bump the points if someone can give a usefull answer.
-Whatsit2002
use ILDASM to open the assembly that you crated using tlbimp and check what is the namespace that is created. It may not be AspCrypt
The rcw dll's tree looks like this:

aspcrypt_rcw.dll
|
|-->M A N I F E S T
|
|--^AspCrypt
   |
   |-I Crypt
   |
   |-_ CryptClass
   |
   |-I ICrypt

There are a couple things under each of the items under AspCrypt, but I think you get the idea. I believe this indicates that the namespace is actually AspCrypt which is what I am trying to import, right?
Note: the ^ before the name "AspCrypt" is my poor ascii art representation of a shield icon.
-Whatsit2002
I figured it out! I dumped the AspCrypt_RCW.dll file into the %root%\bin\ of my .NET application and it works spledidly. naveenkohli, you get the points for, at least, pointing me in the right directions.

-Whatsit2002