How do i transfer this unmanaged code from asp to asp.net 2/mvc?
- by melaos
hi guys,
i'm a newbie to ASP.net interop features, so what i have right here is some unmanaged dll that i need to call from my asp.net mvc app.
the dll name is CTSerialNumChecksum.dll
set CheckSumObj = Server.CreateObject("CTSerialNumChecksum.CRC32API")
validSno = CheckSumObj.ValidateSerialNumber(no)
i know it's unmanaged because when i try to add reference to the dll it doesn't work.
i try to follow some tutorials on interop and marshalling but thus far i wasn't able to get the code to work.
i'm trying to wrap the object into another static class and just let the rest of the app to call the code.
using System;
using System.Runtime.InteropServices;
namespace OnlineRegisteration.Models
{
public static class SerialNumberChecksum
{
[DllImport("CTSerialNumChecksum")]
public static extern int ValidateSerialNumber(string serialNo);
}
}
Questions:
How do i write the class?
And what tool can i use to identify
what type of dll a particular file
is, i.e. unmanaged c++, etc?
Also i intend to make use jquery to
do ajax call later so i can use this
to validate my form pre-submission.
Is there a better way to handle
this?