Link to home
Start Free TrialLog in
Avatar of r3r
r3rFlag for United States of America

asked on

ASP.NET, ADO.NET System.Security.SecurityException: Requested registry access is not allowed

Hi,

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..

:-)
 

r3r

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:         '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

Stack Trace:


[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.OleDb.OleDbConnectionString.ValidateParse()
   System.Data.Common.DBConnectionString..ctor(String connectionString, UdlSupport checkForUdl)
   System.Data.OleDb.OleDbConnectionString..ctor(String connectionString)
   System.Data.OleDb.OleDbConnectionString.ParseString(String connectionString)
   System.Data.OleDb.OleDbConnection.set_ConnectionString(String value)
   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.UI.Control.OnInit(EventArgs e)
   System.Web.UI.Control.InitRecursive(Control namingContainer)
   System.Web.UI.Page.ProcessRequestMain()
   System.Web.UI.Page.ProcessRequest()
   System.Web.UI.Page.ProcessRequest(HttpContext context)
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
   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
Avatar of ihenry
ihenry

Use simpler connection string.

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Inetpub\wwwroot\myWEB\DataGrid\bin\Course.mdb;User Id=admin;Password=;"
Avatar of r3r

ASKER

Good thought, but no luck here,either.  Still getting same type message w/ new connection string.

Source Error:


Line 16:         'conConnection
Line 17:         '
Line 18:         Me.conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Inetpub\wwwroot\myWEB\DataGrid\bi" & _
Line 19:         "n\Course.mdb;User Id=admin;Password=;"
Line 20:
 

Source File: d:\inetpub\wwwroot\myWEB\DataGridII\StudentData.aspx.vb    Line: 18

Stack Trace:


[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.OleDb.OleDbConnectionString.ValidateParse()
   System.Data.Common.DBConnectionString..ctor(String connectionString, UdlSupport checkForUdl)
   System.Data.OleDb.OleDbConnectionString..ctor(String connectionString)
   System.Data.OleDb.OleDbConnectionString.ParseString(String connectionString)
   System.Data.OleDb.OleDbConnection.set_ConnectionString(String value)
   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:35
   System.Web.UI.Control.OnInit(EventArgs e)
   System.Web.UI.Control.InitRecursive(Control namingContainer)
   System.Web.UI.Page.ProcessRequestMain()
   System.Web.UI.Page.ProcessRequest()
   System.Web.UI.Page.ProcessRequest(HttpContext context)
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
   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
Avatar of r3r

ASKER

I resolved the issue.  I had to re-map the virtual directories in wwwroot folder for the new security settings to take place.  Thanks anyway.

r3r

Please post a request to delete this question and refund points.
https://www.experts-exchange.com/Community_Support/
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial