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.Ole Db.OleDbCommand , I want an instance
from *my* System.Data.Ole Db.OleDbCommand to be created (that in turn will
eventually create an instance of the real System.Data.Ole Db.OleDbCommand ,
granted the caller will pass my security checks). I don't want the customer
to have to call something like System.Data.MyC ustomOleDb.OleD bCommand,
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 15 2295
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.Ole Db.OleDbCommand with an object that will
bypass the System.Data.Ole Db.OleDbPermiss ion 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 ... 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.Ole Db.OleDbCommand , I want an instance from *my* System.Data.Ole Db.OleDbCommand to be created (that in turn will eventually create an instance of the real System.Data.Ole Db.OleDbCommand , granted the caller will pass my security checks). I don't want the
customer to have to call something like System.Data.MyC ustomOleDb.OleD bCommand, 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,
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.Ole Db.OleDbCommand with an object that will
bypass the System.Data.Ole Db.OleDbPermiss ion 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 ... 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.Ole Db.OleDbCommand , I want an instance from *my* System.Data.Ole Db.OleDbCommand to be created (that in turn will eventually create an instance of the real System.Data.Ole Db.OleDbCommand , granted the caller will pass my security checks). I don't want the
customer to have to call something like System.Data.MyC ustomOleDb.OleD bCommand, 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
> I cannot replace the System.Data.Ole Db.OleDbCommand with an object that will bypass the System.Data.Ole Db.OleDbPermiss ion permissions.
Is there a good reason why not? Is it strictly not possible, or is it just
that OleDbPermission s 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.Ole Db to be "routed" to *my* version of System.Data.Ole Db.*
(which would act like a proxy to the real System.Data.Ole Db). 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
> I cannot replace the System.Data.Ole Db.OleDbCommand with an object that will bypass the System.Data.Ole Db.OleDbPermiss ion permissions.
Is there a good reason why not? Is it strictly not possible, or is it just
that OleDbPermission s 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.Ole Db to be "routed" to *my* version of System.Data.Ole Db.*
(which would act like a proxy to the real System.Data.Ole Db). 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
> Is there a good reason why not? Is it strictly not possible, or is it just that OleDbPermission s relies on OleDbCommand being there, and being named like that? In which case I could maybe replace OleDbCommand as well...
Security.
If someone was using an existing method in OleDB type that did this:
Begin SomeMethod
Demand Permissions
If Demand OK Then do secure action
End SomeMethod
Now you replace the assembly and SomeMethod with your own version:
Begin SomeMethod
do secure action
End SomeMethod
This is a security breach, no?
Not to mention when .NET applications are built, the resulting manifest
contains which assemblies its dependent upon, along with versions, along
with public key tokens.
The better thing to do is have your clients rely on the standard data
provider interfaces instead, use the factory pattern which can be configured
to pass back your objects or OleDB objects.
"Thomas Christmann" <th************ ***@online.de> wrote in message
news:9n******** *************** *****@40tude.ne t... I cannot replace the System.Data.Ole Db.OleDbCommand with an object that
will bypass the System.Data.Ole Db.OleDbPermiss ion permissions.
Is there a good reason why not? Is it strictly not possible, or is it just that OleDbPermission s 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.Ole Db to be "routed" to *my* version of System.Data.Ole Db.* (which would act like a proxy to the real System.Data.Ole Db). 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
> Begin SomeMethod Demand Permissions If Demand OK Then do secure action End SomeMethod
Now you replace the assembly and SomeMethod with your own version:
Begin SomeMethod do secure action End SomeMethod
This is a security breach, no?
Well, yes, I understand this would be a security breach, but I was looking
more for why it isn't allowed. Technically, I mean. What prevents it? CAS?
Something deep inside the assembly itself?
Not to mention when .NET applications are built, the resulting manifest contains which assemblies its dependent upon, along with versions, along with public key tokens.
Ah okay, key tokens, that I understand. Okay, thats a reason it wouldn't
work, true.
The better thing to do is have your clients rely on the standard data provider interfaces instead, use the factory pattern which can be configured to pass back your objects or OleDB objects.
Well, I can't really use OleDB. See, the scenario is that I host ASP.NET
applications on my server, but I don't want to run full trust.
Unfortunately OleDB only works with full trust. So, an article on the MS
website explained that you could write a wrapper around some OleDB
functionality, then register that in gac (to be run under full trust), and
call the (full trusted, globally available) assembly from ASP.NET
applications running under partial trust. Now, this works just fine, I bet,
but the ultimate goal would be to give my clients the convinience of not
having to use my stuff, but the MS stuff instead (from their point of
view).
Ciao,
Thomas
Thomas,
I'm not sure what the full reason is. Nor if you really can or cannot do
it.
I believe you missed my point, one very good reason to prevent it is
security, as JD explained, and I attempted to explain. What you are
attempting to do is how one might bypass security.
Just a thought
Jay
"Thomas Christmann" <th************ ***@online.de> wrote in message
news:9n******** *************** *****@40tude.ne t... I cannot replace the System.Data.Ole Db.OleDbCommand with an object that
will bypass the System.Data.Ole Db.OleDbPermiss ion permissions. Is there a good reason why not? Is it strictly not possible, or is it just that OleDbPermission s 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.Ole Db to be "routed" to *my* version of System.Data.Ole Db.* (which would act like a proxy to the real System.Data.Ole Db). 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
Thomas,
Oh! another reason to prevent it, your assembly could introduce
instabilities in the framework.
I can here the calls to MS Support now. I'm using OleDbCOmmand on my machine
and it works fine, I deploy it to my ISP and I get a Argument Out Of Range
exception. (as your wrapper had a slight flaw in it, that you did not
catch...)
If you find it documented how to do it, I hope you will post here.
Just another thought
Jay
"Thomas Christmann" <th************ ***@online.de> wrote in message
news:9n******** *************** *****@40tude.ne t... I cannot replace the System.Data.Ole Db.OleDbCommand with an object that
will bypass the System.Data.Ole Db.OleDbPermiss ion permissions. Is there a good reason why not? Is it strictly not possible, or is it just that OleDbPermission s 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.Ole Db to be "routed" to *my* version of System.Data.Ole Db.* (which would act like a proxy to the real System.Data.Ole Db). 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
> What prevents it? CAS?
Yep. Unfortunately OleDB only works with full trust.
No kidding. I never realized this or ran into a problem because of it.
"Thomas Christmann" <th************ ***@online.de> wrote in message
news:53******** *************** *******@40tude. net... Begin SomeMethod Demand Permissions If Demand OK Then do secure action End SomeMethod
Now you replace the assembly and SomeMethod with your own version:
Begin SomeMethod do secure action End SomeMethod
This is a security breach, no?
Well, yes, I understand this would be a security breach, but I was looking more for why it isn't allowed. Technically, I mean. What prevents it? CAS? Something deep inside the assembly itself?
Not to mention when .NET applications are built, the resulting manifest contains which assemblies its dependent upon, along with versions, along with public key tokens.
Ah okay, key tokens, that I understand. Okay, thats a reason it wouldn't work, true.
The better thing to do is have your clients rely on the standard data provider interfaces instead, use the factory pattern which can be
configured to pass back your objects or OleDB objects.
Well, I can't really use OleDB. See, the scenario is that I host ASP.NET applications on my server, but I don't want to run full trust. Unfortunately OleDB only works with full trust. So, an article on the MS website explained that you could write a wrapper around some OleDB functionality, then register that in gac (to be run under full trust), and call the (full trusted, globally available) assembly from ASP.NET applications running under partial trust. Now, this works just fine, I
bet, but the ultimate goal would be to give my clients the convinience of not having to use my stuff, but the MS stuff instead (from their point of view).
Ciao,
Thomas This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robin Becker |
last post by:
Is there a way to override a data property in the instance? Do I need to create
another class with the property changed?
--
Robin Becker
|
by: Dave Y |
last post by:
I am a newbie to C# and am having trouble trying to override a ListView
property method. I have created a new class derived from the Forms.Listview
and I cannot figure out the syntax to override ListView.Items.Add(), . I see
that it is a virtual method so it should be easy to do. If anyone can help I
would appreciate it greatly. I can do what I need to do in a different way
this would just make everything significantly cleaner and eaasier...
|
by: songie D |
last post by:
Does c# support overriding by name and not signature
For instance I am building a custom collection class, that ca
only take a certain type of object
For this, I have added an override for add from the class view
and changed it fro
public int Add(object value
t
public int Add(MyItemClass value
This seems to work, but it generates a warning 'the new specifier is needed
|
by: Kishore Gopalan |
last post by:
Hi,
I have the following class.
Assembly: A.dll
public class Customers {
public Customer customer;
}
public class Customer {
public string name;
|
by: Dave |
last post by:
We have developed a few .NET components. The application access these
components through well defined interface IOurInterface.
The application list display name of each component in the dialog, so
user can choose which one he wants to use. To display list of available
components we have to associate human redable display name with each
component.
To get that display name of component we added the method GetDisplayName to
IOurInterface.
| |
by: Michael Bøcker-Larsen |
last post by:
Hi
I'v been stuck on this problem for ages now. I have found that I'm not
the only one with this problem, by looking through the different
newsgroups.
Hope you can help me! I know there is a lot of information, but if you
need more (e.g. the code) please write michael@mblarsen.dk.
The problem is this error messages (the code is build just fine; no errors):
|
by: Thomas Christmann |
last post by:
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |