用自定义程序集覆盖现有的类名? [英] Override existing class name with custom assembly?

查看:72
本文介绍了用自定义程序集覆盖现有的类名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!


我在这里有一个相当特殊的问题。我想为.NET程序集编写一个包装器

,然后在我的服务器上注册,以便我的服务器上的人们调用我的程序集而不是标准的.NET程序集。原因

是我想在我的程序集中包含一些额外的安全检查,

以防止每个人都不选中调用.NET程序集。所以,

编写包装器没问题,但是我不知道如何/是否可以

在服务器上注册我的程序集来调用*

原始程序集的*,使用原始名称。所以,例如如果客户

创建了System.Data.OleDb.OleDbCommand的实例,我想要创建一个来自* my * System.Data.OleDb.OleDbCommand的实例

(反过来,这将是
最终创建一个真实的System.Data.OleDb.OleDbCommand实例,

授予调用者将通过我的安全检查)。我不希望客户

必须打电话给System.Data.MyCustomOleDb.OleDbCommand,

,因为我的班级不能在他们的客户那里找到当他们为他们的应用创建

时计算机,否则它会更容易。

我记得实现上述功能并不是COM的问题,但是它是
在.NET中也可以
吗?


TIA,


Thomas

Hi!

I have a rather special question here. I''d like to write a wrapper
for a .NET assembly, and register that on my server so that the people on
my server call my assembly instead of the standard .NET assembly. Reason
is that I want to include some additional security checks in my assembly,
to prevent everybody from the calling the .NET assembly unchecked. So,
writing the wrapper is no problem, but I''m not sure how/if it is possible
to register my assembly on the server to be called *instead* of the
original assembly, using the original name. So, e.g. if the customer
creates an instance of System.Data.OleDb.OleDbCommand, I want an instance
from *my* System.Data.OleDb.OleDbCommand to be created (that in turn will
eventually create an instance of the real System.Data.OleDb.OleDbCommand,
granted the caller will pass my security checks). I don''t want the customer
to have to call something like System.Data.MyCustomOleDb.OleDbCommand,
since my class won''t be available at their client computer when they create
their apps, and it will be just easier otherwise.
I remember that achieving the above was no probelm with COM, but is it
possible in .NET as well?

TIA,

Thomas

推荐答案

托马斯,

我的理解是.NET内置的安全性阻止了这种情况发生的原因很大程度上是因为你想要它发生这种情况。


在使用.NET安全性的情况下,我不能引入一个降低标准组件的安全性的程序集。

我无法用一个对象来替换System.Data.OleDb.OleDbCommand,该对象将绕过System.Data.OleDb.OleDbPermission权限。


为了好的有关.NET安全性的文章的评论见:
http://msdn.microsoft.com/library/de...rksecurity.asp


希望这个帮助

Jay


" Thomas Christmann" <第*************** @ online.de>在留言中写道

新闻:5t *************************** @ 40tude.net ...
Thomas,
My understanding is the security built into .NET prevents this from
happening for largely the opposite reason then you are wanting it to happen.

In that with .NET security I cannot introduce an assembly that reduces the
security of the standard assemblies.

I cannot replace the System.Data.OleDb.OleDbCommand with an object that will
bypass the System.Data.OleDb.OleDbPermission permissions.

For a good starting point on articles on .NET security see:
http://msdn.microsoft.com/library/de...rksecurity.asp

Hope this helps
Jay

"Thomas Christmann" <th***************@online.de> wrote in message
news:5t***************************@40tude.net...
嗨!

我在这里有一个相当特殊的问题。我想为.NET程序集编写一个包装器,并在我的服务器上注册它,以便我的服务器上的人员调用我的程序集而不是标准的.NET程序集。原因
是我想在我的程序集中包含一些额外的安全检查,以防止每个人都无法调用.NET程序集。所以,编写包装器没问题,但是我不知道如何/是否可以在服务器上注册我的程序集来代替*原来的
汇编,使用原始名称。所以,例如如果客户创建了System.Data.OleDb.OleDbCommand的实例,我想要创建一个来自* my * System.Data.OleDb.OleDbCommand的实例(反过来它将会
最终创建一个真实System.Data.OleDb.OleDbCommand的实例,
授予调用者将通过我的安全检查)。我不希望
客户必须调用类似System.Data.MyCustomOleDb.OleDbCommand的内容,因为我们的课程在
创建时无法在客户端计算机上使用他们的应用程序,否则会更容易。
我记得实现上述内容并不是COM的问题,但它在.NET中是否可行?

TIA ,
Hi!

I have a rather special question here. I''d like to write a wrapper
for a .NET assembly, and register that on my server so that the people on
my server call my assembly instead of the standard .NET assembly. Reason
is that I want to include some additional security checks in my assembly,
to prevent everybody from the calling the .NET assembly unchecked. So,
writing the wrapper is no problem, but I''m not sure how/if it is possible
to register my assembly on the server to be called *instead* of the
original assembly, using the original name. So, e.g. if the customer
creates an instance of System.Data.OleDb.OleDbCommand, I want an instance
from *my* System.Data.OleDb.OleDbCommand to be created (that in turn will
eventually create an instance of the real System.Data.OleDb.OleDbCommand,
granted the caller will pass my security checks). I don''t want the customer to have to call something like System.Data.MyCustomOleDb.OleDbCommand,
since my class won''t be available at their client computer when they create their apps, and it will be just easier otherwise.
I remember that achieving the above was no probelm with COM, but is it
possible in .NET as well?

TIA,

Thomas



Thomas,

我的理解是.NET内置的安全性阻止了这个来自

发生的原因主要是因为你希望它发生。


因为使用.NET安全性我无法引入一个减少

标准程序集的安全性。


我无法用一个对象来替换System.Data.OleDb.OleDbCommand

绕过System.Data.OleDb.OleDbPermission权限。


关于.NET安全性文章的一个很好的起点,请参阅:
http://msdn.microsoft.com/library/de...rksecurity.asp


希望这会有所帮助

Jay


" Thomas Christmann" <第*************** @ online.de>在留言中写道

新闻:5t *************************** @ 40tude.net ...
Thomas,
My understanding is the security built into .NET prevents this from
happening for largely the opposite reason then you are wanting it to happen.

In that with .NET security I cannot introduce an assembly that reduces the
security of the standard assemblies.

I cannot replace the System.Data.OleDb.OleDbCommand with an object that will
bypass the System.Data.OleDb.OleDbPermission permissions.

For a good starting point on articles on .NET security see:
http://msdn.microsoft.com/library/de...rksecurity.asp

Hope this helps
Jay

"Thomas Christmann" <th***************@online.de> wrote in message
news:5t***************************@40tude.net...
嗨!

我在这里有一个相当特殊的问题。我想为.NET程序集编写一个包装器,并在我的服务器上注册它,以便我的服务器上的人员调用我的程序集而不是标准的.NET程序集。原因
是我想在我的程序集中包含一些额外的安全检查,以防止每个人都无法调用.NET程序集。所以,编写包装器没问题,但是我不知道如何/是否可以在服务器上注册我的程序集来代替*原来的
汇编,使用原始名称。所以,例如如果客户创建了System.Data.OleDb.OleDbCommand的实例,我想要创建一个来自* my * System.Data.OleDb.OleDbCommand的实例(反过来它将会
最终创建一个真实System.Data.OleDb.OleDbCommand的实例,
授予调用者将通过我的安全检查)。我不希望
客户必须调用类似System.Data.MyCustomOleDb.OleDbCommand的内容,因为我们的课程在
创建时无法在客户端计算机上使用他们的应用程序,否则会更容易。
我记得实现上述内容并不是COM的问题,但它在.NET中是否可行?

TIA ,

Thomas
Hi!

I have a rather special question here. I''d like to write a wrapper
for a .NET assembly, and register that on my server so that the people on
my server call my assembly instead of the standard .NET assembly. Reason
is that I want to include some additional security checks in my assembly,
to prevent everybody from the calling the .NET assembly unchecked. So,
writing the wrapper is no problem, but I''m not sure how/if it is possible
to register my assembly on the server to be called *instead* of the
original assembly, using the original name. So, e.g. if the customer
creates an instance of System.Data.OleDb.OleDbCommand, I want an instance
from *my* System.Data.OleDb.OleDbCommand to be created (that in turn will
eventually create an instance of the real System.Data.OleDb.OleDbCommand,
granted the caller will pass my security checks). I don''t want the customer to have to call something like System.Data.MyCustomOleDb.OleDbCommand,
since my class won''t be available at their client computer when they create their apps, and it will be just easier otherwise.
I remember that achieving the above was no probelm with COM, but is it
possible in .NET as well?

TIA,

Thomas



>我无法用一个
绕过System.Data.OleDb.OleDbPermission权限的对象替换System.Data.OleDb.OleDbCommand。
bypass the System.Data.OleDb.OleDbPermission permissions.




有充分理由不这样做吗?严格地说不可能,或者只是OleDbPermissions依赖于OleDbCommand在那里,并且被命名为

那样只是

?在这种情况下我也可以替换OleDbCommand ......


也许我应该清楚一点:我的目标不是要真正取代OleDb

完全,我只想让所有ASP.NET调用以下所有内容

System.Data.OleDb为路由" to * my * version of System.Data.OleDb。*

(这将作为真正的System.Data.OleDb的代理)。所以,我不想b $ b想要替换它,我只是想劫持。它的名字,系统范围。在COM

这很容易实现,只需访问注册表并用类似
$ b $的内容替换旧组件的ProgID键的

值。 bcomponent.old并分别在同一个密钥中为新组件提供旧的

组件的原始名称。然后新组件将通过调用component.old来引用旧组件,而在系统范围内,新的
组件将替换旧组件(并且将像代理一样运行) )。

这是我想用.NET程序集实现的。可能?如果不是,为什么

不是? :-)


谢谢,


托马斯



Is there a good reason why not? Is it strictly not possible, or is it just
that OleDbPermissions relies on OleDbCommand being there, and being named
like that? In which case I could maybe replace OleDbCommand as well...

Maybe I should clear this up a bit: My aim is not to really replace OleDb
completely, I just would like to have all ASP.NET calls to everything below
System.Data.OleDb to be "routed" to *my* version of System.Data.OleDb.*
(which would act like a proxy to the real System.Data.OleDb). So, I don''t
want to replace it, I just want to "hijack" it''s name, system wide. In COM
this was easily acheived by just going to the registry and replacing the
value of the ProgID key of the old component with something like
"component.old" and giving your new component the original name of the old
component, in the same key, respectively. The new component would then
reference the old one by calling component.old, and system wide, the new
component would replace the old component (and would act like a proxy).
THIS I would like to achieve with .NET assemblies. Possible? If no, why
not? :-)

Thanks,

Thomas


这篇关于用自定义程序集覆盖现有的类名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆