Configuration File

  • Thread starter Thread starter Thom Little
  • Start date Start date
T

Thom Little

I have an ASP.NET application that I am trying to run on my local server. I
have administrator privilege.

It contains:

private void btnThomButton_Click(object sender, System.EventArgs e)
{
EventLog eventLog = new EventLog("Application" );
eventLog.Source = "Application" ;
eventLog.WriteEntry( "Message" );
}

When this is executed the WriteEntry causes an 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.

What and where is this configuration file?
 
By default the ASPNET user account does not have permission to create Event
Logs.
Generally the EventLog would be created at time of installation.
This avoids your runtime security limitation of the default ASPNET user
account.
Another approach is to use impersonation to have ASP.NET run under another
user account that has permissions to create an event log.
Here's more details:
http://support.microsoft.com/?id=329291
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
 
Back
Top