Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.0
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 4th, 2003, 02:21 PM
Registered User
Join Date: Dec 2003
Location: Schaumburg, IL, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Security exception comes when writing to event log

I am trying to write to event log. When I run it I get a Security Exception message shown below. I am using windowsXP Pro and have administrator rights.

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 16: string LogName = "MyApplicationLog";
Line 17: string SourceName = "MyApplicationSource";
Line 18: if(!(EventLog.SourceExists(SourceName)))
Line 19: {
Line 20: EventLog.CreateEventSource(SourceName, LogName);

I read it on this forum that this can be fixed by changing the appEvent.evt file's security setting but I am not able to see the security tab for AppEvent.evt file. Please advice.



  #2 (permalink)  
Old December 17th, 2003, 09:48 PM
cjo cjo is offline
Authorized User
Join Date: Oct 2003
Location: Smyrna, Georgia, USA.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts

If you don't alread have a web.config file do this:

Create a new file and save it as "web.config" in either your root directory or the directory that contains the code that is trying to create the event log. Copy and paste the xml contents below into this file. Be sure to replace your actual computername/username and password (the same info you use to log into Windows) in the "identity" element below. Then attempt to run the code again. I had the same error, and this worked for me. Good luck!

<?xml version="1.0" encoding="UTF-8" ?>
<identity impersonate="true" userName="COMPUTERNAME\USername" password="password" />

P.S. If you're already using a web.config file, then just add the identity element as shown above within the system.web element.
  #3 (permalink)  
Old December 27th, 2003, 06:05 AM
Friend of Wrox
Join Date: May 2003
Location: Delhi, Delhi, India.
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts


You need to disable simple file sharing option exists under the TOOLS>>FOLDER OPTIONS>>VIEW TAB. This is the last item in list of options you get in VIEW TAB. After that you are able to use the security tab for any folder while viewing its properties.

  #4 (permalink)  
Old September 23rd, 2004, 02:31 PM
Registered User
Join Date: Sep 2004
Location: Seattle, , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Did you ever find an answer to this problem? I'm having the same difficulty... the only thing that has worked is to make my user an administrator of the machine, which is not acceptable.

  • In web.config, I have
  •     <identity impersonate="true" userName="mydomain\myuser" password="*****" />
  • Try to use
        EventLog.WriteEntry( "hello" );
  • I get the error
        System.Security.SecurityException: Requested registry access is not allowed.
  #5 (permalink)  
Old October 21st, 2004, 09:17 AM
Registered User
Join Date: Oct 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

That worked! I was able to add

<identity impersonate="true" userName="COMPUTERNAME\USername" password="password" />

to my existing web.config and continue on.

Now if I can only get my vendor to fix this problem...


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to log to server's event log LenexaKS Access VBA 4 March 11th, 2008 12:49 PM
AppException Class -Log Error to Event Log bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 7 December 7th, 2004 01:01 PM
crystal report with asp.net log-on fail exception avinash sharma LNCT Crystal Reports 0 December 6th, 2004 01:42 AM
Checking Security Event log for failed logins Ronb722 VBScript 2 September 29th, 2004 10:04 AM
ASP.NET C# Writing to Event Log Problem wireblock ASP.NET 1.0 and 1.1 Basics 1 July 26th, 2003 04:08 AM

All times are GMT -4. The time now is 12:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.