I need to call .net dll function inside of classic asp.
So i regsitered dll and tlb file with regasm.exe (and /codebase parameter). there is no problem.
There is a sql databse and some table have image type data (inside has picture data). I want to send image data to dll function like a image or byte() type.
my asp code part:
================================================== =======
Expand|Select|Wrap|Line Numbers
- Set jpg = Server.CreateObject("ad_jpeg.Jpeg")
- jpg.openBinary(rs("prev")) 'prev is sql 2008 image type
- my .net dll function
- =========================================================
- Public Function openBinary(ByVal gln As Object) As Boolean
- If gln Is Nothing Then
- lastError = "No binary data"
- Return False
- Else
- Try
- Dim img As Image
- Dim ms = New MemoryStream(CType(gln, Byte()))
- img = Image.FromStream(ms)
- If img IsNot Nothing Then
- jpeg = img
- Return True
- Else
- lastError = "Incoming data error"
- Return False
- End If
- Catch ex As Exception
- lastError = "Incoming type of data : " & gln.GetType().ToString & vbCrLf & ex.ToString
- Return False
- End Try
- End If
- End Function
asp browse this error:
Incoming type of data : System.__ComObject
System.InvalidCastException: 'System.__ComObject' cannot assing byte type etc....