SecurityException when trying to write to event log.

S

Suhail Salman

Dear all,
why do i get the following exception when i try to write to the event
log from a webform. and how can i resolve it?

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.

i changed the trust level in my computer zone to full trust. but its still
the same, even though that this exception is thrown from a dll which is
referenced in the major project.

thank you for your help.
suhail
 
J

John Saunders

Suhail Salman said:
Dear all,
why do i get the following exception when i try to write to the event
log from a webform. and how can i resolve it?

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.

i changed the trust level in my computer zone to full trust. but its still
the same, even though that this exception is thrown from a dll which is
referenced in the major project.

This problem usually occurs when there is no event source defined. The first
write to the event source will try to create it. That's what you don't have
access to do.

Create the event source manually first. Look into the EventLogInstaller
class.
 
J

Jeff

The problem is that the aspnet account, by default, does not have the
security rights to create the event log application. You can manually
create this by editing the registry. Go to
HKLM\System\CurrentControlSet\Services\EventLog\Application and add a node
underneath with the name of the application you are reporting in the event
log.

You can find the MS article on this problem here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;329291&Product=aspnet
Jeff
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top