Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / October 2006



Tip: Looking for answers? Try searching our database.

ASP code using DLL from VB.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Jahnz - 03 Oct 2006 13:59 GMT
This post is a modifed version of one I made to the interop section (on
09.29.2006) but no one replied... since the question is partially about ASP
this group may be appropriate. Any help you could offer would be much
appreciated!!

I need help getting some VB.NET code (via a DLL) to work with classic ASP to
perform HMACSHA1 processing / validation. I already have the HMACSHA1 code
working as VB.NET code.

I've created VB.NET (ApplicationType is Class Library) code using Visual
Studio 2005, that can calculate a HMAC hash, Base64Encode the result, and
return the value... The Visual Studio 2005 project has the checkbox for
interop selected in the project properties section. The VB.NET code is as
follows (and does work correctly):

Namespace HMAC_HELPER
   Public Class HMAC_HELPER
       Public Sub New()
       End Sub

       Private Function ConvertStringToByteArray(ByVal stringToConvert)
           Dim ue As New System.Text.UnicodeEncoding
           Return ue.GetBytes(stringToConvert)
       End Function

       Public Function getHash(ByVal stringToHash, ByVal stringHashKey)
           Dim sha As New
System.Security.Cryptography.HMACSHA1(ConvertStringToByteArray(stringHashKey))
           Dim data As Byte()
           Dim hashValue As Byte()
           Dim returnValue As String
           data = ConvertStringToByteArray(stringToHash)
           hashValue = sha.ComputeHash(data)
           returnValue = Convert.ToBase64String(hashValue)
           Return returnValue
       End Function
   End Class
End Namespace

I need the ability to access the above code from a DLL file via Classic ASP
like this:
Classic ASP Code:
...
Dim Obj
Set Obj = Server.CreateObject("HMAC_HELPER")
newHashValue = Obj.getHash(aString, hashKey)
Obj = nothing
...

I have used the redasm.exe and gacutil to register the assembly, but cannot
get the ASP code to recognize the DLL file "HMAC_HELPER".

Would someone please explain the steps I need (or missed) to get this
working, as the ASP code has no idea what the "HMAC_HELPER" is. I get the
following error from classic asp:
Server object, ASP 0177 (0x800401F3)
Invalid class string

Any help or direction would be much appreciated. If an alternative approach
exists, I'd be interested in learning about it.

Thank you.
-Michael
Mike - 03 Oct 2006 14:09 GMT
> This post is a modifed version of one I made to the interop section (on
> 09.29.2006) but no one replied... since the question is partially about
> ASP this group may be appropriate.

Ummm wrong again, I'm afraid.  Ths group covers classic asp.  The one you
want for dotnet is at microsoft.public.dotnet.framework.aspnet.

--
Mike Brind
Mike - 03 Oct 2006 14:12 GMT
>> This post is a modifed version of one I made to the interop section (on
>> 09.29.2006) but no one replied... since the question is partially about
>> ASP this group may be appropriate.
>
> Ummm wrong again, I'm afraid.  Ths group covers classic asp.  The one you
> want for dotnet is at microsoft.public.dotnet.framework.aspnet.

Opps.  Sorry.  Didn't read all of your post....
Patrice - 03 Oct 2006 14:10 GMT
I would remove the namespace statement and would use
<RootNameSpace>.HMAC_HELPER for the classid.

Else your best bet is likely to just have a look at the registry to see what
is the exact registered classid. For now I would think that the classid
string used from ASP is not correct...

Good luck.
Signature

Patrice

> This post is a modifed version of one I made to the interop section (on
> 09.29.2006) but no one replied... since the question is partially about
[quoted text clipped - 59 lines]
> Thank you.
> -Michael
Sri - 27 Oct 2006 08:54 GMT
I tried this with Visaul Studio 2003, but if I try the same with VS 2005, I am getting the error msg "Invalid class string " ..any ideas

rgds,
Sri
Sri - 27 Oct 2006 08:54 GMT
I tried this with Visaul Studio 2003, but if I try the same with VS 2005, I am getting the error msg "Invalid class string " ..any ideas

rgds,
Sri
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.