Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 3rd, 2004, 01:15 PM
Authorized User
 
Join Date: Mar 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm just speculating, is perhaps the reason why Server.CreateObject can't find
my test.dll, is because it's a ASP.NET assembly as you say, and not a registered
ActiveX component. So that would mean Server.CreateObject is useless for
ASP.NET assembly DLLs.

 
Old April 3rd, 2004, 05:02 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, correct. Server.CreateObject is used to create a server instance of a COM object. CreateObject uses late binding (that is, the type of the object isn't known until runtime.

You should use the Dim bla1 As New Bla() construct for classes defined in .NET assemblies (even if they are just a wrapper around a "classic" COM object) and use Server.CreateObject to instantiate COM objects directly.

Theoretically, both methods below should work:
Code:
' 1. Late Binding, using CreateObject against a COM ProgID
Dim MyTestApp As Object
MyTestApp = Server.CreateObject("Test.Application")

' 2. Strongly typed, against a .NET assembly
Dim Obj As Test.Application
Obj = New Test.Application()
I am still a bit surprised that the first method doesn't work for you. This code:
Code:
Dim objConn As Object
objConn = Server.CreateObject("ADODB.Connection")
returns a perfectly valid ADODB Connection object, so the same should apply to your COM object as well.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is Server,CreateObject("File.clsFile")? SMM Classic ASP Professional 0 May 7th, 2007 08:31 AM
How To use server.createobject in c# ranakdinesh C# 0 November 4th, 2005 08:18 AM
Server.CreateObject Failed patwadd Classic ASP Databases 3 February 7th, 2005 05:46 PM
Server.CreateObject Failed ckwizard77 Classic ASP Components 2 October 23rd, 2004 09:41 AM
Server.CreateObject("Outlook.Application") Dave Sell Classic ASP Professional 1 September 4th, 2004 01:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.