T
Tumurbaatar S.
How to allow the default user account of ASP.NET to access system registry
of WinXP?
My page raises following exception and I believe that happens because my
script
accesses the Event Log of WinXP:
my code:
if (EventLog.SourceExists("MySource"))
EventLog.CreateEventSource("MySource", "MyLog");
using (EventLog ev = new EventLog("MyLog", ".", "MySource"))
{
....
ev.WriteEntry(MyMessage, EventLogEntryType.Error);
....
}
error details:
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:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
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) +78
System.Diagnostics.EventLog.SourceExists(String source) +11
card.RespFrm.Page_Load(Object sender, EventArgs e) +787
....
of WinXP?
My page raises following exception and I believe that happens because my
script
accesses the Event Log of WinXP:
my code:
if (EventLog.SourceExists("MySource"))
EventLog.CreateEventSource("MySource", "MyLog");
using (EventLog ev = new EventLog("MyLog", ".", "MySource"))
{
....
ev.WriteEntry(MyMessage, EventLogEntryType.Error);
....
}
error details:
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:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
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) +78
System.Diagnostics.EventLog.SourceExists(String source) +11
card.RespFrm.Page_Load(Object sender, EventArgs e) +787
....