views:

88

answers:

6

I wrote a small function in C# that manipulates pdf files using itextsharp. Is it possible to call this function from a classic asp page?

-Vivek

+1  A: 

Yes.

You can either expose your C# class via COM to the Classic ASP page or create a .NET Web Service that you can call from the Classic ASP page.

Personally, I would suggest exposing your C# class via COM (follow the "Exposing C# to COM" section).

Justin Niessner
A: 

Probably. You'll need to COM expose it.

Robaticus
Wow, hater's gotta hate, I guess. I'm not sure why the down-vote, as the answer is, frankly, correct. The answer is definitely *not* a simple "yes," as there are elements that can cause it to be unable to be called from classic ASP, and the answer (as shown elsewhere) is to COM expose the DLL.
Robaticus
A: 

Yes, if you register the C# assembly as a COM+ component (using regsvcs.exe). You can then do this:

Set myObject = Server.CreateObject("mynamespace.myobject.myclass")
myObject.MyMethod()
Sandor Drieënhuizen
Why COM+? Why not good old-fashioned COM?
Robaticus
@Robaticus: AFAIK, you can't do that with .NET.
Sandor Drieënhuizen
Sure you can. That's what interop is for.
Robaticus
You're right, I stand corrected.
Sandor Drieënhuizen
A: 

Here

Bruno Costa
A: 

One option is to use the .NET utility TlbExp.exe to create the CCW for the .NET library. This CCW can definitely be called from classic ASP. You can instantiate it using Server.CreateObject ("...") http://msdn.microsoft.com/en-us/library/hfzzah2c(VS.80).aspx

InSane
excellent!.......
Vivek Chandraprakash
A: 

Build the C# code into a dll and use REGASM to expose it to COM clients (like asp). Alternately, on the project settings..compile tab you can check the box "Register for COM Interop"

JohnFx