?
Solved

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

Posted on 2004-11-25
6
Medium Priority
?
620 Views
Last Modified: 2007-11-27
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
0
Comment
Question by:r3r
  • 2
  • 2
5 Comments
 
LVL 20

Expert Comment

by:ihenry
ID: 12678303
Use simpler connection string.

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

Author Comment

by:r3r
ID: 12678348
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
0
 

Author Comment

by:r3r
ID: 12678478
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
0
 
LVL 20

Expert Comment

by:ihenry
ID: 12678484

Please post a request to delete this question and refund points.
http://www.experts-exchange.com/Community_Support/
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12724756
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question