all groups > dotnet security > july 2007 >
You're in the

dotnet security

group:

Help on EventLog security ???


Help on EventLog security ??? calderara
7/19/2007 7:20:05 AM
dotnet security: Dear all,

I am buidling as assembly which logs potentials generated error or exception
in Event viewer.
For that I am through code creating an EventSource for the log before
writing inside.
I have noticed that for creating that source you need to be an administrator
user.
So if my libryr is executed my a client aplication under a normal user
context, I will have an exception error when creating the EventSource.

How can I be an administrator from my code only during the needed time ?
Sure I might change the contect of my code to be an admin and then
impersonate during the execution of my admin part, then probably use the Undo
method to recover to normal user but how ?

My assembly would need also the EvenLog permission i guess ?
As declarative of imperative mode.

thnaks for help
regards
Re: Help on EventLog security ??? Nicole Calinoiu
7/20/2007 9:20:17 AM
[quoted text, click to view]

You won't be able to do this unless the user knows administrative account
credentials. A better approach would be to register the event log source
during the installation of the application, which is presumably performed
under an administrative user context.


[quoted text, click to view]

To write to a previously registered event log source,
EventLogPermission\Write for the target event log (presumably the local
machine event log in this case). Locally installed code is granted this
permission under default CAS policy.


[quoted text, click to view]

Sorry, but I don't understand what you mean by this.

[quoted text, click to view]




AddThis Social Bookmark Button