Using a .NET User Control in Classic ASP

Associate
Joined
28 Nov 2004
Posts
1,237
Location
Birmingham
Hi,
Although experienced in Classic ASP, I'm new to the .NET side of things but I was wondering if the following is possible....and if so, how?!? :)

I want to create a .NET user control...lets say, a calendar control with a few functions built into it.
Can I compile that into a DLL, register it on my server and then create and use the object in my classic ASP pages?

Sorry if that's a little vague....like I say, I'm new to this.
 
Nope. IIS will need to be running .NET 1.1 or .NET 2.0 to run .NET user controls. If you want to use .NET user controls it is time to upgrade.

TrUz
 
Sorry - should have said - the server is .NET ready so running .NET components isn't an issue.

My main query is whether (and roughly how) a user control made in .NET and setup on the server can be accessed via a classic ASP page.
 
You can do it, probably, but it won't be worth the effort.

It would have to be created as a normal .Net dll, which you would then wrap in a CCW (Com Callable Wrapper), then create a strong name, then export the type library, then register it with regasm, then in the GAC with gacutil, then you would have a callable object from asp using Server.CreateObject as normal for calling .dlls

You'd lose every single reason for using the .Net control in the first place, ie. being able to plop it on a form and fiddle with it make changes, etc. As every change you make to the .dll would mean a recompile, and updating the GAC on the server (assuming you have access to the GAC, which you won't do on 99% of hosted servers.)

My advice? Upgrade the site to use ASP.Net, or just use any of the 100s of "custom type" controls that have already been written for classic ASP.

:)
 
basicly the answer is no.

You could create a COM wrapped .NET object, that outputted HTML as text which you could then write to the response buffer, but the amount of work required would almost certainly not be worth it.

If you really need .NET I'd consider porting the whole ASP application to .NET

akakjs
 
Back
Top Bottom