0

I'm working on a legacy application developed in classic ASP. One of pages has code written which goes like this -

Set secCon = Server.CreateObject("foo.methodname")
secCon.prop1 = Method1

I can't find any definition of foo.methodname anywhere in the code which is very frustrating. I guess my question is whether there is a way to create an instance of an object which doesn't have any definition in the code you're working on.

  • Suggest you read [this answer](https://stackoverflow.com/a/35985827/692942) from the duplicate target which breaks down exactly how you locate the COM DLL that is the source of the ProgId used in `CreateObject()`. – user692942 Mar 16 '22 at 22:28
  • @user692942 - Hi. Thanks because this was very helpful. What is the physical location/path of these DLLs. Let's say something was missing then from where do I look and copy the required DLLs? – Kaustav Dutta Mar 17 '22 at 09:35
  • It depends, the physical location is based on where the DLLs were stored when they were registered to COM using `regsvr32.exe`. If the entry in the registry doesn't exist for `foo.methodname` that means they've never been registered on that server. This kind of thing can happen when sites are migrated from one server to another but the dependent COM DLLs were not taken with it and then registered on the new server. – user692942 Mar 17 '22 at 09:39
  • @user692942 Is there a way to get the path from Registry Editor itself? The DLLs were registered a while back and I don't have any documentation on the original location of the DLLs. The entry does exist in the Registry but I would like to create that same entry in another system. – Kaustav Dutta Mar 17 '22 at 21:10
  • Yes, read the section ["What If You Don't Know Where the DLL Is Located?" of the answer I linked](https://stackoverflow.com/a/35985827/692942). There is an example given that breaks down the process into four steps. – user692942 Mar 17 '22 at 21:57

1 Answers1

0

That’s just a placeholder / example

Usually you’d use Server.CreateObject to create to an external app, library or process, like for Database Connection, as an example

Worth reading this https://www.w3schools.com/asp/met_createobject_server.asp

Mike Irving
  • 1,480
  • 1
  • 12
  • 20
  • 1
    It’s for accessing COM DLLs registered through `regsvr32.exe`. The reference used in `CreateObject()` is known as a "ProgID" which is registered in the `HKEY_CLASS_ROOT` registry hive. – user692942 Mar 16 '22 at 23:00