I am doing Ch17 entrytolog.aspx. When I run it I get a Security Exception message shown below. I am using windowsXP and have administrator rights. My BegASPNET virtual directory has all rights.
I get a sense that this involves windows security but I don't know where to start. Please advise. Thanks.
gary@electronicmirror.com
Server Error in '/BegASPNET' Application.
--------------------------------------------------------------------------------
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);
Source File: C:\BegASPNET\Ch17\entrytolog.aspx Line: 18
Stack Trace:
[SecurityException: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
System.Diagnostics.EventLog.FindSourceRegistration (String source, String machineName, Boolean readOnly) +295
System.Diagnostics.EventLog.SourceExists(String source, String machineName) +79
System.Diagnostics.EventLog.SourceExists(String source) +11
ASP.entrytolog_aspx.Page_Error(Object sender, EventArgs e) in C:\BegASPNET\Ch17\entrytolog.aspx:18
System.Web.UI.TemplateControl.OnError(EventArgs e) +109
System.Web.UI.Page.HandleError(Exception e) +68
System.Web.UI.Page.ProcessRequestMain() +2065
System.Web.UI.Page.ProcessRequest() +118
System.Web.UI.Page.ProcessRequest(HttpContext context) +18
System.Web.CallHandlerExecutionStep.Execute() +179
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +87
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.288; ASP.NET Version:1.0.3705.288
gary@electronicmirror.com