|
-
Jun 1st, 2004, 01:28 PM
#1
Thread Starter
New Member
Having trouble with a registry read
I have a program that reads a value in the registry. When I "Debug" it, it works. When I build and run the EXE I get a Security Error.
Is there something I need to do in the program that allows registry reads?
Here is my code:
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\SNAP Systems, Inc\WinSNAP\DefaultSite")
DefaultSite = CType(key.GetValue(""), String)
EDIT:
Exact Error>
Request for the permission of type
System.Security.Permissions.RegistryPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
Thank you
Ron.
PS: I'm not sure (because I'm a NOOBIE) if there is anything else you'll need to know. Please ask and I'll provide.
Last edited by Capt_Ron; Jun 1st, 2004 at 01:43 PM.
-
Jun 2nd, 2004, 06:03 AM
#2
What type of logon authority do you have? Are you logged in as an administrator, or a regular user?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 2nd, 2004, 07:44 AM
#3
Thread Starter
New Member
I'm a domain admin.
I guess that is the problem. Any ideas around it?
Is there a way to read the registry without opening it? Or does Windows assume that any interaction with the registry is bad and therefore a regular User can't access it?
Ron.
-
Jun 2nd, 2004, 07:59 AM
#4
Actually, a domain admin should have no permission issues. That's a wierd one.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 2nd, 2004, 09:32 AM
#5
Thread Starter
New Member
Maybe I was unclear. I do that sometimes
I have no problems running this. The regular Users do.
Ron.
-
Jun 2nd, 2004, 09:53 AM
#6
I think that regular users have access to the HKEY_CURRENT_USER registry key at the very most, but they might not even have that.
Is this a key you have created, or is it defined by another app?
If its yours, you might want to look into using xml or something else that is a little less locked down.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 2nd, 2004, 10:47 AM
#7
Thread Starter
New Member
It's created by another App.
Here's a thought. Is there a way to get Computer Name?
The value I'm trying to get is a 4 digit number. That number is also part of their computer name.
Could I get and parse the computer name and use that instead?
hmmm.....
This could get interesting...
Ron.
PS: I really appreciate your help!!!!
-
Jun 2nd, 2004, 03:23 PM
#8
Thread Starter
New Member
I Got It!!! I Got It!!!
I'm sooooo smart.... Or at least the author of the book is and I just happened to find it. hehe.
I'll use the Computername Environment variable and parse it.
I found the code in VB.NET Cookbook (MS press). Good book.
I also found a nice variable called TMP which is the Temp directory path for the current user. I get to use that too!
Now this is making an assumption that certain environment variables are still available in XP Pro.
I really appreciate your help. Didn't get a registry solution, but led me to a better one!!
Man! I love forums!!
Capt Ron.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|