ASP.NET, ADO.NET System.Security.SecurityException: Requested registry access is not allowed
Posted on 2004-11-25
I'm having the typical problem of running an ASP.NET / ADO.NET app on my home machine and getting the error:
System.Security.SecurityException: Requested registry access is not allowed
I've read a lot of solutions for this, but none are working for me. I'm even getting the error if I recreate the application from scratch. Basically, I can't access an access database from ASP (all other non-database apps work fine, so ASP.NET is installed correctly)
I originally created the application on a lab machine at school (Win XP Pro, non-admin account) and am trying to modify it on my home rig (Win 2000, Administrator account).
Here's what I've tried so far:
from administrative tools- tried using Microsoft .NET Framework 1.1 Configuration
-tried Microsoft .NET Framework 1.1 Wizards
-adjusted .net security to full trust for local and MyComputer
-trust the assembly in question (in this case assembly name is DataGridII.dll
- tried "fix the application wizard", but the DataGridII is not listed.
after that I changed the permission for IUSR_myMachine, IWAM_myMachine, and ASPNET all to have admistrator priveleges-still no luck.
Next, I went into the machine.config file and changed "machine" to "system" under process model tag, but that didn't work.
And of course, I've rebooted, restarted IIS many, many times in between.
What is the deal with this? I know this exception is from not having permission to access the registry, but I would think after all these changes I should have no problem whatsover.
Any help is greatly appreciated. I've also scoured this site and combed through the first 50 searches on Google/ Yahoo. If you find a fix I missed send it on...
Oh yea, I also changed the registry to allow event logging, though that wasn't my specific concern. Somehow this is a related issue.
500 points to the first genious who solves this one..
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.
Line 16: 'conConnection
Line 17: '
Line 18: Me.conConnection.ConnectionString = "Jet OLEDB:Registry Path=;Data Source=""D:\Inetpub\wwwroot\myWEB\DataGrid\bin\Cours" & _
Line 19: "e.mdb"";Jet OLEDB:System database=;Jet OLEDB:Global Bulk Transactions=1;User ID=A" & _
Line 20: "dmin;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:Don't Copy Locale on Compact=F" & _
Source File: d:\inetpub\wwwroot\myWEB\DataGridII\StudentData.aspx.vb Line: 18
[SecurityException: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
System.Data.Common.ADP.ClassesRootRegistryValue(String subkey, String queryvalue)
System.Data.Common.DBConnectionString..ctor(String connectionString, UdlSupport checkForUdl)
DataGridII.WebForm1.InitializeComponent() in d:\inetpub\wwwroot\myWEB\DataGridII\StudentData.aspx.vb:18
DataGridII.WebForm1.Page_Init(Object sender, EventArgs e) in d:\inetpub\wwwroot\myWEB\DataGridII\StudentData.aspx.vb:40
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032