Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.0
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2003, 02:21 PM
Registered User
 
Join Date: Dec 2003
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.

Thanks
Sangeeta

Thanks


 
Old December 17th, 2003, 09:48 PM
cjo cjo is offline
Authorized User
 
Join Date: Oct 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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" ?>
<configuration>
<system.web>
<identity impersonate="true" userName="COMPUTERNAME\USername" password="password" />
</system.web>
</configuration>

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.
 
Old December 27th, 2003, 06:05 AM
Friend of Wrox
 
Join Date: May 2003
Posts: 229
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

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.



 
Old September 23rd, 2004, 02:31 PM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Summary:
 
  • 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.
 
Old October 21st, 2004, 09:17 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That worked! I was able to add

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

to my existing web.config and continue on.
thanks!

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






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





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