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

5 Answers 5

2

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).

Sign up to request clarification or add additional context in comments.

Comments

1

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()

2 Comments

@Robaticus: AFAIK, you can't do that with .NET.
Sure you can. That's what interop is for.
0

Probably. You'll need to COM expose it.

2 Comments

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.
"Why are you booing me? I'm right!" I upvoted you to compensate. :-P
0

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

Comments

0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.