Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / February 2004

Tip: Looking for answers? Try searching our database.

RegistryPermission Error HELP!!!!!!!!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sean McKaharay - 17 Feb 2004 19:38 GMT
I am wondering if anyone can help me out with this one. Here goes....... I
have my local machine (Windows XP framework 1.1) and a Server (Windows 2003
framework 1.1). When I go to run my code on my box and late bind to a dll on
the server machine I get an error. Below is the lines of code and the error
I get. I have no problem accessing the Reports.dll so it should not be a
security problem. I get the error when I try to run the class rptBadge. I am
getting a RegistryPermission error. Here is some background on the
class..... I am extending from a class from a 3rd party. We have paid for
the product and I am wondering if it has something to do with that. The
third party might have some information in the registry and I don't have
permissions to read the registry.

Any help would be appreciated.

System.Reflection.Assembly ControlAssembly =
System.Reflection.Assembly.LoadFrom("\\Server1\Reports\output\Reports.dll");

report =
(ProductionActiveReportBase)
ControlAssembly.CreateInstance("Reports.Production.rptBadge");

THE ERROR:

{"Request for the permission of type
System.Security.Permissions.RegistryPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed." }
Robert Jarratt [MSFT] - 20 Feb 2004 11:25 GMT
When you load an assembly from a share the assembly falls into the
LocalIntranet code group and gets the LocalIntranet permision set. The
RegistryPermission is not in this permission set so any registry access from
managed code will fail with the exception that you are seeing. There are
various solutions depending on your situation, any of the following would
help:

1. Copy the server assembly to your client and load it from there.

2. Create a custom code group to identify the server assembly (is it
strongly-named?) and assign it more permissions.

3. Get the vendor to modify the code so that it does not need to access the
registry (unlikely I suppose)

There are other solutions but they are a bad idea from a security point of
view.

I hope that one of these will help you.

Signature

Robert Jarratt, MCSD
Microsoft Ltd.

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

> I am wondering if anyone can help me out with this one. Here goes....... I
> have my local machine (Windows XP framework 1.1) and a Server (Windows 2003
[quoted text clipped - 11 lines]
>
> System.Reflection.Assembly ControlAssembly =

System.Reflection.Assembly.LoadFrom("\\Server1\Reports\output\Reports.dll");

> report =
> (ProductionActiveReportBase)
[quoted text clipped - 6 lines]
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
> failed." }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.