473,626 Members | 3,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SecurityExcepti on

I'm trying to run a modified version of the example in this Microsoft
article:
http://msdn.microsoft.com/library/de...sekeytopic.asp

The only changes I've made to the code is that instead of using
"HKEY_CURRENT_U SER\Environment " as my registry path I'm using
"HKEY_LOCAL_MAC HINE\Software\P olicies\Microso ft\Windows" and setting
OpenRemoteBaseK ey to open RegistryHive.Lo calMachine instead of the
CurrentUser.

The problem is that I keep getting a SecurityExcepti on. I've tried inserting
the code below inside the try block but with no apparent effect

// *************** *************

SecurityPermiss ion sp =

new SecurityPermiss ion(SecurityPer missionFlag.Unm anagedCode);

sp.Demand();

// *************** *************

Anybody got a clue what's wrong and what I can do to fix it?
Sep 21 '06 #1
2 2176

"Chuck B" <ch****@shc1.co mwrote in message
news:e$******** ******@TK2MSFTN GP02.phx.gbl...
| I'm trying to run a modified version of the example in this Microsoft
| article:
|
http://msdn.microsoft.com/library/de...sekeytopic.asp
|
| The only changes I've made to the code is that instead of using
| "HKEY_CURRENT_U SER\Environment " as my registry path I'm using
| "HKEY_LOCAL_MAC HINE\Software\P olicies\Microso ft\Windows" and setting
| OpenRemoteBaseK ey to open RegistryHive.Lo calMachine instead of the
| CurrentUser.
|
| The problem is that I keep getting a SecurityExcepti on. I've tried
inserting
| the code below inside the try block but with no apparent effect
|
| // *************** *************
|
| SecurityPermiss ion sp =
|
| new SecurityPermiss ion(SecurityPer missionFlag.Unm anagedCode);
|
| sp.Demand();
|
| // *************** *************
|
| Anybody got a clue what's wrong and what I can do to fix it?
|
|

Your problem is windows security related not CAS rlated.
You must run your code while impersonating a "remote system" administrator,
only administrators can access HKLM.

Willy.

Sep 21 '06 #2

"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:uc******** ******@TK2MSFTN GP05.phx.gbl...
>
"Chuck B" <ch****@shc1.co mwrote in message
news:e$******** ******@TK2MSFTN GP02.phx.gbl...
| I'm trying to run a modified version of the example in this Microsoft
| article:
|
http://msdn.microsoft.com/library/de...sekeytopic.asp
|
| The only changes I've made to the code is that instead of using
| "HKEY_CURRENT_U SER\Environment " as my registry path I'm using
| "HKEY_LOCAL_MAC HINE\Software\P olicies\Microso ft\Windows" and setting
| OpenRemoteBaseK ey to open RegistryHive.Lo calMachine instead of the
| CurrentUser.
|
| The problem is that I keep getting a SecurityExcepti on. I've tried
inserting
| the code below inside the try block but with no apparent effect
|
| // *************** *************
|
| SecurityPermiss ion sp =
|
| new SecurityPermiss ion(SecurityPer missionFlag.Unm anagedCode);
|
| sp.Demand();
|
| // *************** *************
|
| Anybody got a clue what's wrong and what I can do to fix it?
|
|

Your problem is windows security related not CAS rlated.
You must run your code while impersonating a "remote system"
administrator,
only administrators can access HKLM.

Willy.
Ok thanks. Does it make any difference that I set myself as a user with
control permissions on every key in the path that I'm trying to access?
Sep 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6483
by: Mark Rodrigues | last post by:
Hi everyone, Today we hit a problem when we rolled a new web-site are were presented with a error on our page that looked like: Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
0
1432
by: | last post by:
I have been learning really hard to understand this .NET security thing, but I still get overwhelmed with the abstractness. The hardest part is to understand *when* you get an SecurityException and *how* I would translate this into a simple-user-friendly messagebox. And *when* you get a PolicyException and I also want to translate this into a simple-user-friendly messagebox. The idea is then to start up some...
1
6803
by: Sam | last post by:
I have a desktop VB.Net application I developed locally. I uploaded it to a file server we have and the .Net Framework is installed on the file server. When I try to run the executable from the network drive, I get, "System.Security.SecurityException." When I Open the solution from the network drive, I get, "The project location is not fully trusted by the .Net runtime. And then when I click ok and try to run in debug mode I get...
0
3355
by: James B | last post by:
OMA (Outlook Mobile Access) under Exchange is giving me a System.Security.SecurityException error. From what I gather this is a problem with the security level under which the OMA application is trying to run. Anyone got some ideas on where I can start in getting this worked out? I've posted in Exchange but I'm thinking this group may actually have more ideas. Security Exception Description: The application attempted to perform an...
0
1541
by: Brian A | last post by:
I have code that calls some Win32 code. My library is accessed via remoting from a client. In version 1.0 of the framework I had no problems. With 1.1 I consitently get the securityException: An unhandled exception of type 'System.Security.SecurityException' occurred in myfile.dll Additional information: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral,...
2
3151
by: MFRASER | last post by:
I am getting a System.Security.SecurityException when I try and laod a dataset from an xml file any ideas on what would cause this? System.Security.SecurityException' occurred in mscorlib.dll Additional information: Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
2
4219
by: jwgoerlich | last post by:
I wrote a simple VB.Net console application. It accepts command line parameters and creates a folder structure. It works on the local file system without a problem If I run the console app from a UNC or network share, I get a SecurityException on the following line: Dim args() As String = Environment.GetCommandLineArgs() Has anyone seen this before? Is there something special I need to do
0
828
by: Mythran | last post by:
Class1: <PrincipalPermission(SecurityAction.Demand, Role := "MyRole")> _ Public Function Fetch() As DataTable End Function Class2: Public Function Fetch() As DataTable Dim cls1 As Class1 = New Class1() Try Return cls1.Fetch()
0
970
by: Michael | last post by:
Re: system.security.securityexception The program I have written requires "Full Trust" to run and will throw a security exception if a user tries to load it while working in the Intranet Zone, i.e., on a LAN. I am trying to trap the error, and advise the user via a messagebox to request the LAN administrator to set up the user machine to allow "full trust" thus permitting the code to run.
4
9083
by: stephen | last post by:
Hi, I am getting an error while trying to create an excel file. "Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Permission denied" This is what I am doing. we had an app that...
0
8265
marktang
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...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
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...
0
7193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
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...
0
4092
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...
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.