Error Reading the Security Log

G

Guest

I am getting this error when I try and read the events in the Security log.

A required privilege is not held by the client!

My web site is set up as Integrated Authentication and in my web.config I
have the following
<identity impersonate="true" />

Since I am an Admin on my box and on the domain, why can't ASP.NET C# code
read my security log?

Here is my code:

EventLog aLog = new EventLog();
aLog.Entries;
string sLogName = DDLEventLog.SelectedItem.Value.ToString();
aLog.Log = sLogName;
aLog.MachineName = Environment.MachineName;
LogGrid.DataSource = aLog.Entries;
* LogGrid.DataBind();

* is where the error occurs when I try and bind the results from the log to
a grid.


Thanks

Tom
 
D

David Lloyd

Tom:

If you are running on Windows 2000, the following KB article may be
relevant.

http://support.microsoft.com/default.aspx?scid=kb;en-us;810204

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I am getting this error when I try and read the events in the Security log.

A required privilege is not held by the client!

My web site is set up as Integrated Authentication and in my web.config I
have the following
<identity impersonate="true" />

Since I am an Admin on my box and on the domain, why can't ASP.NET C# code
read my security log?

Here is my code:

EventLog aLog = new EventLog();
aLog.Entries;
string sLogName = DDLEventLog.SelectedItem.Value.ToString();
aLog.Log = sLogName;
aLog.MachineName = Environment.MachineName;
LogGrid.DataSource = aLog.Entries;
* LogGrid.DataBind();

* is where the error occurs when I try and bind the results from the log to
a grid.


Thanks

Tom
 
W

Willy Denoyette [MVP]

Tom said:
I am getting this error when I try and read the events in the Security log.

A required privilege is not held by the client!

My web site is set up as Integrated Authentication and in my web.config I
have the following
<identity impersonate="true" />

Since I am an Admin on my box and on the domain, why can't ASP.NET C# code
read my security log?

Here is my code:

EventLog aLog = new EventLog();
aLog.Entries;
string sLogName = DDLEventLog.SelectedItem.Value.ToString();
aLog.Log = sLogName;
aLog.MachineName = Environment.MachineName;
LogGrid.DataSource = aLog.Entries;
* LogGrid.DataBind();

* is where the error occurs when I try and bind the results from the log
to
a grid.


Thanks

Tom

Make sure you are effectively impersonating an Administrator.

Willy.
 
G

Guest

Willy:

Can you elaborate on your comment?

What exactly do you mean when you say "Make sure you are effectively
impersonating an Administrator"?

I'm not sure what to change?

Also, I am running under windows 2000 Server.
 
W

Willy Denoyette [MVP]

Tom said:
Willy:

Can you elaborate on your comment?

What exactly do you mean when you say "Make sure you are effectively
impersonating an Administrator"?

I'm not sure what to change?

Also, I am running under windows 2000 Server.

:

Did you check the current principal's identity name?

WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
String username = wp.Identity.Name;

What happens if you run your code (part of) as administrator from a console
application?

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top