Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Custom Event Log Write Error

Reply
Thread Tools

Custom Event Log Write Error

 
 
TJO
Guest
Posts: n/a
 
      11-26-2003
We are experiencing the following error when writing to a custom log file:
"Requested registry access is not allowed."

We have created the custom log file using the code below and then add full
permissions to the ASPNET account at the Registry Key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog.

We do not experience the error when writing to the "Application" Event log
or if we run the code from a windows form application.

// Code Fails when writing to custom event log "SR_AppLog
EventLog appLog = new EventLog("SR_AppLog", ".");
appLog.Source = "SR_AppDev";
appLog.WriteEntry("foo bar: database error");
appLog.Dispose();


//Code executs when writing to "Application" event log
EventLog appLog = new EventLog("Application");
appLog.Source = "SR_AppSrc";
appLog.WriteEntry("foo bar: database error");
appLog.Dispose();

//Installer class to create the custom event log
namespace EventLogSourceInstaller

{

[RunInstaller(true)]

public class MyEventLogInstaller : Installer

{

private EventLogInstaller myEventLogInstaller;

public MyEventLogInstaller()

{

//Create Instance of EventLogInstaller

myEventLogInstaller = new EventLogInstaller();

// Set the Source of Event Log, to be created.

myEventLogInstaller.Source = "SR_AppDev";

// Set the Log that source is created in

myEventLogInstaller.Log = "SR_AppLog";


// Add myEventLogInstaller to the Installers Collection.

Installers.Add(myEventLogInstaller);

}

}

}


 
Reply With Quote
 
 
 
 
Stefano Pronti [MS]
Guest
Posts: n/a
 
      11-28-2003
Have a look at that:
329291 PRB: "Requested Registry Access Is Not Allowed" Error Message When
http://support.microsoft.com/?id=329291

Cheers,
Stefano Pronti

Microsoft Developer Support

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


"TJO" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> We are experiencing the following error when writing to a custom log file:
> "Requested registry access is not allowed."
>
> We have created the custom log file using the code below and then add full
> permissions to the ASPNET account at the Registry Key
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog.
>
> We do not experience the error when writing to the "Application" Event log
> or if we run the code from a windows form application.
>
> // Code Fails when writing to custom event log "SR_AppLog
> EventLog appLog = new EventLog("SR_AppLog", ".");
> appLog.Source = "SR_AppDev";
> appLog.WriteEntry("foo bar: database error");
> appLog.Dispose();
>
>
> //Code executs when writing to "Application" event log
> EventLog appLog = new EventLog("Application");
> appLog.Source = "SR_AppSrc";
> appLog.WriteEntry("foo bar: database error");
> appLog.Dispose();
>
> //Installer class to create the custom event log
> namespace EventLogSourceInstaller
>
> {
>
> [RunInstaller(true)]
>
> public class MyEventLogInstaller : Installer
>
> {
>
> private EventLogInstaller myEventLogInstaller;
>
> public MyEventLogInstaller()
>
> {
>
> //Create Instance of EventLogInstaller
>
> myEventLogInstaller = new EventLogInstaller();
>
> // Set the Source of Event Log, to be created.
>
> myEventLogInstaller.Source = "SR_AppDev";
>
> // Set the Log that source is created in
>
> myEventLogInstaller.Log = "SR_AppLog";
>
>
> // Add myEventLogInstaller to the Installers Collection.
>
> Installers.Add(myEventLogInstaller);
>
> }
>
> }
>
> }
>
>



 
Reply With Quote
 
 
 
 
TJO
Guest
Posts: n/a
 
      11-28-2003
we have followed these instructions on your recommended article. The
problem with the article is that it explains how to set permission for the
"Application" event log. It then goes on to show how to create your own
Even Log using a custom installer class which is also what we have done.
Our problem is that we can write to the Application event log but not to the
custom event log. We only get the Acccess not allowed error when writing to
the custom event log. Writing to the Application event log is no problem.

Has anyone done this before? What sercurity setting should I look for ?



"Stefano Pronti [MS]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Have a look at that:
> 329291 PRB: "Requested Registry Access Is Not Allowed" Error Message When
> http://support.microsoft.com/?id=329291
>
> Cheers,
> Stefano Pronti
>
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>
>
> "TJO" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > We are experiencing the following error when writing to a custom log

file:
> > "Requested registry access is not allowed."
> >
> > We have created the custom log file using the code below and then add

full
> > permissions to the ASPNET account at the Registry Key
> > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog.
> >
> > We do not experience the error when writing to the "Application" Event

log
> > or if we run the code from a windows form application.
> >
> > // Code Fails when writing to custom event log "SR_AppLog
> > EventLog appLog = new EventLog("SR_AppLog", ".");
> > appLog.Source = "SR_AppDev";
> > appLog.WriteEntry("foo bar: database error");
> > appLog.Dispose();
> >
> >
> > //Code executs when writing to "Application" event log
> > EventLog appLog = new EventLog("Application");
> > appLog.Source = "SR_AppSrc";
> > appLog.WriteEntry("foo bar: database error");
> > appLog.Dispose();
> >
> > //Installer class to create the custom event log
> > namespace EventLogSourceInstaller
> >
> > {
> >
> > [RunInstaller(true)]
> >
> > public class MyEventLogInstaller : Installer
> >
> > {
> >
> > private EventLogInstaller myEventLogInstaller;
> >
> > public MyEventLogInstaller()
> >
> > {
> >
> > //Create Instance of EventLogInstaller
> >
> > myEventLogInstaller = new EventLogInstaller();
> >
> > // Set the Source of Event Log, to be created.
> >
> > myEventLogInstaller.Source = "SR_AppDev";
> >
> > // Set the Log that source is created in
> >
> > myEventLogInstaller.Log = "SR_AppLog";
> >
> >
> > // Add myEventLogInstaller to the Installers Collection.
> >
> > Installers.Add(myEventLogInstaller);
> >
> > }
> >
> > }
> >
> > }
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Impersonation and Custom Event Log - write access denied JimLad ASP .Net 0 01-26-2010 03:59 PM
Using Enterprise Library to write in a custom event log Eniac ASP .Net 1 08-01-2008 02:33 PM
Write to error log using redirect:write Petterson Mikael XML 1 09-11-2006 12:06 PM
ASP Problem: "IIS log failed to write entry" in Event Log cherryparadise001@gmail.com ASP General 0 05-26-2006 01:52 AM



Advertisments