简体   繁体   English

ASP中的Server.CreateObject(progId)如何工作?

[英]How Server.CreateObject(progId) in ASP works?

I'm migrating some old classic ASP code to ASP.Net. 我正在将一些旧的经典ASP代码迁移到ASP.Net。 One of the pages creates an instance of a COM component with: 其中一个页面使用以下内容创建COM组件的实例:

obj = Server.CreateObject("myProgId").

In the C# version I'm trying to do the same using something like this: 在C#版本中,我尝试使用类似的方法做同样的事情:

dynamic obj = Activator.CreateInstance(Type.GetTypeFromProgID("myProgId"));

The question is if both lines of code get an instance of the same class considering that the same ProgID could be registered more than once with a different ClassID . 问题是,考虑到同一ProgID可以使用不同的ClassID多次注册,因此这两行代码是否都获得同一类的实例。

Second question: Is there any way to know which ClassID is using Server.CreateObject() to create the instance? 第二个问题:是否有办法知道哪个ClassID使用Server.CreateObject()创建实例?

Thanks. 谢谢。

使用这个 sysinternals工具,我可以弄清楚在创建实例时哪个文件可以处理打开位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM