By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,559 Members | 1,150 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,559 IT Pros & Developers. It's quick & easy.

Configuration File

P: n/a
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?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Thom Little" <th**@tlanet.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 18 '05 #2

P: n/a
Steve:

That is exactly the information that I needed.

Thank you.

.... Thom

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
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/de...ersonation.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Thom Little" <th**@tlanet.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.