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 / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

Registry write failing when running program from a network drive

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
utpal - 23 Aug 2006 20:37 GMT
Hi,
My CSharp program, when I run from the local drive it can create/modify
registry. However running the program from a network drive, gives
RegistryPremission error. I don't belive that just by running the program
from a network drive, the program will try to access the registry of the
network machine. Here is the code snippet:
RegistryKey rk =
Registry.CurrentUser.OpenSubKey(@"Software\Solidica\TestRegistryAccess",RegistryKeyPermissionCheck.ReadWriteSubTree);

if (rk == null)

   rk =
Registry.CurrentUser.CreateSubKey(@"Software\Solidica\TestRegistryAccess");

rk.SetValue(this.textBoxName.Text, this.textBoxValue.Text);

rk.Close();

Thanks.
Nicholas Paldino [.NET/C# MVP] - 23 Aug 2006 20:49 GMT
When running from a network location, .NET places limitations on what
the program can do.  The idea behind this is that if you are getting the
code from somewhere that you don't trust, then it shouldn't be able to
access or modify resources on your machine.

   To get around this, I would assign a strong-name to your assembly.
Then, you can go to the .NET configuration tool and assign the permissions
you need to your assembly based on the strong name.

   Hope this helps.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi,
> My CSharp program, when I run from the local drive it can create/modify
[quoted text clipped - 15 lines]
>
> Thanks.

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.