Solution: web application can not access event log
From: chuck rudolph (chuckrudolph_at_discussions.microsoft.com)
Date: 04/06/05
- Next message: Joseph MCAD: "RE: web application can not access event log"
- Previous message: Derek Knudsen: "Rijndael decryption succeeds SOMETIMES"
- In reply to: chuck rudolph: "web application can not access event log"
- Next in thread: Karlo Swart: "RE: Solution: web application can not access event log"
- Reply: Karlo Swart: "RE: Solution: web application can not access event log"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 5 Apr 2005 16:51:02 -0700
Nicole and Joseph put me on the correct track. Here's the scoop. I wrote a
windows app (just because I had one laying around) that did a
EventLog.CreateEventSource("sourceName","logName") for a couple sources for a
"custom log". Then in my web application I did a EventLog el = new
EventLog("logName", ".", "sourceName") and then el.WriteEntry("stuff to log")
and the custom log was written without issue with the web application running
as the standard anonymous user.
So the key seems to be to do not attempt to create a eventLog or an
eventSource in a web application and you will be okay. Joseph is still
educating me on the permissions, so check the long thread if you want those
details....Chuck
"chuck rudolph" wrote:
> In the page_load, I have the following code:
> PermissionSet ps = new PermissionSet(PermissionState.None);
> ps.AddPermission(new EventLogPermission
> EventLogPermissionAccess.Instrument,"."));
> ps.Demand();
> EventLogPermission ps2 = (EventLogPermission)
> ps.GetPermission(typeof(EventLogPermission));
>
> foreach (EventLogPermissionEntry psx in ps2.PermissionEntries)
> {
> this.Response.Write("<p> Machine: " +
> psx.MachineName + " Bits: " + psx.PermissionAccess + " </p>");
> }
>
> When executed it writes:
> Machine: . Bits: Instrument
>
> Which would lead me to believe that I can write to an event log. But when I
> then try to execute these two lines of code:
>
> EventLog el = new EventLog("My Log",".","Login Category");
> el.WriteEntry("Login is getting ready to run!");
>
> ASP.Net (Microsoft .NET Framework Version:1.1.4322.2032) throws the
> following exception:
> Exception Details: System.Security.SecurityException: Requested registry
> access is not allowed.
>
> Any ideas?
>
>
>
- Next message: Joseph MCAD: "RE: web application can not access event log"
- Previous message: Derek Knudsen: "Rijndael decryption succeeds SOMETIMES"
- In reply to: chuck rudolph: "web application can not access event log"
- Next in thread: Karlo Swart: "RE: Solution: web application can not access event log"
- Reply: Karlo Swart: "RE: Solution: web application can not access event log"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|