473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Requested registry access is not allowed.

I have a piece of code (written is Visual Studio 2005) that is only reading
the Security EventLog. On Windows XP Professiona/Home this code works just
fine.

int numberOfEntries = myEventLog.Entries.Count;
if (numberOfEntries > 0) ...

However, when run under Windows Vista I get the error "Requested registry
access is not allowed." This error occurs when the first line of code is
executed.

I tried adding the command below before the count is retrieved but it didn't
work.

EventLogPermission elp = new
EventLogPermission(EventLogPermissionAccess.Admini strator, ".");

Does anyone know how to get around this issue. This error only occurs with
the Security event log, not the "Application" or "System" event logs.

--
-----------
Thanks,
Steve
Jun 8 '06 #1
6 12908
Hi Steve,

I'm sorry, but Windows Vista development is currently not supported, since
it is only in beta version. Let's wait to see if any community member can
shed some light on this issue.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 9 '06 #2
=?Utf-8?B?U3RldmUgVGVlcGxlcw==?= <St****@newsgroups.nospam> wrote
in news:FB**********************************@microsof t.com:
I have a piece of code (written is Visual Studio 2005) that is
only reading the Security EventLog. On Windows XP
Professiona/Home this code works just fine.

int numberOfEntries = myEventLog.Entries.Count;
if (numberOfEntries > 0) ...

However, when run under Windows Vista I get the error "Requested
registry access is not allowed." This error occurs when the
first line of code is executed.

I tried adding the command below before the count is retrieved
but it didn't work.

EventLogPermission elp = new
EventLogPermission(EventLogPermissionAccess.Admini strator, ".");
Steve,

I don't have Windows Vista, but .Net Code Access Security (CAS) can
be a little frustrating when it's first encountered.

Creating a permission object does not have the effect of granting
the program that permission. A .Net program is subject to the
combination of permissions allowed by the OS for the user account the
program is running under, and the permissions allowed by the .Net
runtime (go to the Control Panel/Administrative Tools and open the MS
..Net Configuration utility).

See "Code Access Security" on MSDN2 for more info:

http://msdn2.microsoft.com/en-us/lib...w0(VS.80).aspx
Does anyone know how to get around this issue. This error only
occurs with the Security event log, not the "Application" or
"System" event logs.


If the program is not being run from your machine (i.e. it's being
run from a network drive), then .Net will not give that program a
full set of permissions.

If it's being run on your machine, check the permissions of the user
account the program is running under.

Finally, as Kevin Yu alluded to, Vista is still in beta. It's
possible this is just a yet-to-be-fixed quirk of that OS.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jun 9 '06 #3

"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:FB**********************************@microsof t.com...
|I have a piece of code (written is Visual Studio 2005) that is only reading
| the Security EventLog. On Windows XP Professiona/Home this code works
just
| fine.
|
| int numberOfEntries = myEventLog.Entries.Count;
| if (numberOfEntries > 0) ...
|
| However, when run under Windows Vista I get the error "Requested registry
| access is not allowed." This error occurs when the first line of code is
| executed.
|
| I tried adding the command below before the count is retrieved but it
didn't
| work.
|
| EventLogPermission elp = new
| EventLogPermission(EventLogPermissionAccess.Admini strator, ".");
|
| Does anyone know how to get around this issue. This error only occurs
with
| the Security event log, not the "Application" or "System" event logs.
|
| --
| -----------
| Thanks,
| Steve

Because of User Account Control (UAC) in Vista, the application requires
elevated permissions to get at the Security data. Please read this:
http://msdn.microsoft.com/windowsvis...cprotvista.asp,
especially the part that talks about an assembly manifest.

Note also that you should post Vista related questions to the Microsoft
forums at http://forums.microsoft.com

Willy.
Jun 9 '06 #4
How does one go about configuring a C# appliation to run with Admin
privileges? My test tool is installed under the adminitstrator login and
runs in that environment.

I don't understand what needs to be done to do this.

This line of code (reading the number of Security EventLog entries) is the
only line (out of 1000's) that will not run under Vista. I find it
frustrating.
--
-----------
Thanks,
Steve
"Willy Denoyette [MVP]" wrote:

"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:FB**********************************@microsof t.com...
|I have a piece of code (written is Visual Studio 2005) that is only reading
| the Security EventLog. On Windows XP Professiona/Home this code works
just
| fine.
|
| int numberOfEntries = myEventLog.Entries.Count;
| if (numberOfEntries > 0) ...
|
| However, when run under Windows Vista I get the error "Requested registry
| access is not allowed." This error occurs when the first line of code is
| executed.
|
| I tried adding the command below before the count is retrieved but it
didn't
| work.
|
| EventLogPermission elp = new
| EventLogPermission(EventLogPermissionAccess.Admini strator, ".");
|
| Does anyone know how to get around this issue. This error only occurs
with
| the Security event log, not the "Application" or "System" event logs.
|
| --
| -----------
| Thanks,
| Steve

Because of User Account Control (UAC) in Vista, the application requires
elevated permissions to get at the Security data. Please read this:
http://msdn.microsoft.com/windowsvis...cprotvista.asp,
especially the part that talks about an assembly manifest.

Note also that you should post Vista related questions to the Microsoft
forums at http://forums.microsoft.com

Willy.

Jun 9 '06 #5
Please move this to the Vista forums, this issue is not C# or .NET related,
it's about the way security is implemented in Vista.
http://msdn.microsoft.com/windowsvis...cprotvista.asp,
explain exactly what should be done to run with elevated privileges.
Note that by default the Administrator account is disabled in Vista, you
aren't running with administrator privileges, even if you are a member of
administrators!. I would suggest you read as much as you can about the new
security model before you start coding, also keep in mind that Vista is
still in beta, nothing is carved in stone yet and many things might change
before RTM.

Willy.

"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:C8**********************************@microsof t.com...
| How does one go about configuring a C# appliation to run with Admin
| privileges? My test tool is installed under the adminitstrator login and
| runs in that environment.
|
| I don't understand what needs to be done to do this.
|
| This line of code (reading the number of Security EventLog entries) is the
| only line (out of 1000's) that will not run under Vista. I find it
| frustrating.
| --
| -----------
| Thanks,
| Steve
|
|
| "Willy Denoyette [MVP]" wrote:
|
| >
| > "Steve Teeples" <St****@newsgroups.nospam> wrote in message
| > news:FB**********************************@microsof t.com...
| > |I have a piece of code (written is Visual Studio 2005) that is only
reading
| > | the Security EventLog. On Windows XP Professiona/Home this code works
| > just
| > | fine.
| > |
| > | int numberOfEntries = myEventLog.Entries.Count;
| > | if (numberOfEntries > 0) ...
| > |
| > | However, when run under Windows Vista I get the error "Requested
registry
| > | access is not allowed." This error occurs when the first line of code
is
| > | executed.
| > |
| > | I tried adding the command below before the count is retrieved but it
| > didn't
| > | work.
| > |
| > | EventLogPermission elp = new
| > | EventLogPermission(EventLogPermissionAccess.Admini strator, ".");
| > |
| > | Does anyone know how to get around this issue. This error only occurs
| > with
| > | the Security event log, not the "Application" or "System" event logs.
| > |
| > | --
| > | -----------
| > | Thanks,
| > | Steve
| >
| > Because of User Account Control (UAC) in Vista, the application requires
| > elevated permissions to get at the Security data. Please read this:
| >
http://msdn.microsoft.com/windowsvis...cprotvista.asp,
| > especially the part that talks about an assembly manifest.
| >
| > Note also that you should post Vista related questions to the Microsoft
| > forums at http://forums.microsoft.com
| >
| > Willy.
| >
| >
| >
Jun 9 '06 #6
I'll read through it and see what I can get from it. Thanks.
--
-----------
Thanks,
Steve
"Willy Denoyette [MVP]" wrote:
Please move this to the Vista forums, this issue is not C# or .NET related,
it's about the way security is implemented in Vista.
http://msdn.microsoft.com/windowsvis...cprotvista.asp,
explain exactly what should be done to run with elevated privileges.
Note that by default the Administrator account is disabled in Vista, you
aren't running with administrator privileges, even if you are a member of
administrators!. I would suggest you read as much as you can about the new
security model before you start coding, also keep in mind that Vista is
still in beta, nothing is carved in stone yet and many things might change
before RTM.

Willy.

"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:C8**********************************@microsof t.com...
| How does one go about configuring a C# appliation to run with Admin
| privileges? My test tool is installed under the adminitstrator login and
| runs in that environment.
|
| I don't understand what needs to be done to do this.
|
| This line of code (reading the number of Security EventLog entries) is the
| only line (out of 1000's) that will not run under Vista. I find it
| frustrating.
| --
| -----------
| Thanks,
| Steve
|
|
| "Willy Denoyette [MVP]" wrote:
|
| >
| > "Steve Teeples" <St****@newsgroups.nospam> wrote in message
| > news:FB**********************************@microsof t.com...
| > |I have a piece of code (written is Visual Studio 2005) that is only
reading
| > | the Security EventLog. On Windows XP Professiona/Home this code works
| > just
| > | fine.
| > |
| > | int numberOfEntries = myEventLog.Entries.Count;
| > | if (numberOfEntries > 0) ...
| > |
| > | However, when run under Windows Vista I get the error "Requested
registry
| > | access is not allowed." This error occurs when the first line of code
is
| > | executed.
| > |
| > | I tried adding the command below before the count is retrieved but it
| > didn't
| > | work.
| > |
| > | EventLogPermission elp = new
| > | EventLogPermission(EventLogPermissionAccess.Admini strator, ".");
| > |
| > | Does anyone know how to get around this issue. This error only occurs
| > with
| > | the Security event log, not the "Application" or "System" event logs.
| > |
| > | --
| > | -----------
| > | Thanks,
| > | Steve
| >
| > Because of User Account Control (UAC) in Vista, the application requires
| > elevated permissions to get at the Security data. Please read this:
| >
http://msdn.microsoft.com/windowsvis...cprotvista.asp,
| > especially the part that talks about an assembly manifest.
| >
| > Note also that you should post Vista related questions to the Microsoft
| > forums at http://forums.microsoft.com
| >
| > Willy.
| >
| >
| >

Jun 9 '06 #7

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

Similar topics

3
by: Scott Emick | last post by:
In my visual studio (enterprise arch. 2003) when I try to open my projects, or add to a project a component (vb windows project) I get a big red X inside a red frame and the error pops up: The...
2
by: Brian Campbell | last post by:
Gretings... I have written a Windows Service that accesses a Web Service. Both run fine on my development machine.... After installing both the Windows Service and Web Service on my staging...
1
by: HK | last post by:
I am exceuting the following command in C# using Microsoft.Win32; RegistryKey key = Registry.LocalMachine.OpenSubKey(KeyName); I keep getting the exception "Requested registry access is not...
3
by: bfprog | last post by:
Using IBM iSeries client access OLEDB provider to connect to DB2 on AS/400, but cannot create connection using .NET web app. Using following code: Dim cnTest As New...
4
by: LP | last post by:
Hi, My webservice is currently deployed on WIndows 2000 server and runs pretty fine. I am trying to run my webservice on a Windows 2003 server. My webservice tries to write to a eventlog. The...
0
by: Shane | last post by:
Does anyone have any advise on how I can fix the error message shown below? Thanks in advance for any ideas, Shane Server Error in '/' Application....
5
by: Ankit Aneja | last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the Application Block I configured the DAAB using the Enterprise Library Configuration now this is the error which is coming ...
7
by: Peter Ritchie | last post by:
I'm writing a Web Service and I would like to add performance counter data for monitoring performance of the Web Service's operations over time and load. The problem is, I get the "Requested...
1
by: UK1967 | last post by:
I wrote a ASP.NET application (Windows 2003 Enterprise Server, IIS, .NET Framework 1.1). This application use the Windows (AD) account and impersonation. Some functions in this application contact,...
3
by: JB | last post by:
I am trying to access a registry key on computer like so: key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, computerName).OpenSubKey(Subkey); There are two keys I am trying to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...
0
tracyyun
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...
0
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,...

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.