Cannot Write Exception to Event Log

From: John Gordon (john.gordon.156699@**no-sp4m**wamu.net)
Date: 04/09/03


From: "John Gordon" <john.gordon.156699@**no-sp4m**wamu.net>
Date: Wed, 9 Apr 2003 10:24:15 -0700


There is a better way to do this. The dotnet service
needs to have permissions to write to the event log. You
can do this by chaning a setting in the file mentioned
below:

Open Machine.Config (by default in
C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG) in a
text editor, find the <processModel> section, and set the
userName attribute to "SYSTEM". This is required to
enable event logging in ASP.NET Applications -- which we
use in our custom error handling.

--Excerpt from that most wonderful Wrox book: "ASP.NET
Website Programming", Marco Bellinaso and Kevin Hoffman.

>-----Original Message-----
>I have an ASP.Net form that attempts to write to the
event log on a
>Windows XP Pro machine if an problem occurs. However, I
am getting a
>security exception when the form tries to do that. (See
below). This
>occurs regardless of whether I run form in Visual
Studio.Net or from
>browser. User account on machine is memeber of
administrators. Is
>there some other account running this that needs some
sort of .Net
>code policy or something?
>
>
>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.
>
>Exception Details: System.Security.SecurityException:
Requested
>registry access is not allowed.
>
>Source Error:
>
>
>Line 47: Dim log As New EventLog()
>Line 48: log.Source = "DivisionPage"
>Line 49: log.WriteEntry(err.Message,
>EventLogEntryType.Error)
>Line 50:
>Line 51:
>.
>



Relevant Pages

  • Re: Event Log Trust Level?
    ... Any idea on what permissions to give ASPNET (registry ... I don't fancy the installer option. ... >What I do in this case is install the event log as part ... >> source, String logName, String machineName, Boolean ...
    (microsoft.public.dotnet.security)
  • Re: security exception within Microsoft Application Block ExceptionManager.vb
    ... I am in the registry now. ... > ASPNET account doesn't have permission to create EventLog's, ... > Accessing the Event Log ... > not have sufficient permissions to create new event sources. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: DNS Server entries within Event Viewer is empty
    ... Please check the size and the permission of the DNS server event log ... Administrators and System have Full Control permissions on this file. ... >> Microsoft Online Partner Support ...
    (microsoft.public.win2000.dns)
  • Re: ASPNET cant write in event log on win XP
    ... I also put ASPNET in ... >> Changing file and folder permissions isn't going to help anything. ... >> to change permissions for the Event Log. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Cant Create Appointments in OWA 2003
    ... You will need to confirm your permissions for NTFS and Authentication Levels ... The Virtual Directories are very important with regard to the ability to ... >>> Application event log on the server. ... >>> as this user's master account. ...
    (microsoft.public.exchange.setup)