index > .NET Framework Data Access and Storage > Access to path to the database was denied

Access to path to the database was denied


I'm getting a server error in my ASP.NET 2.0 application when trying to access an Access database. This is the error message:
"Access to path to the database was denied. The location does not exist or is not accessible because of security settings".

I'm using a GridView control with AccessDataSource.
The Access database is on Windows Server 2003 with IIS 6.0, ASP.NET 2.0, and SharePoint 3.0

This is the ASP.NET code:

<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/UFR_db.mdb"
SelectCommand="SELECT * FROM [Projects] WHERE ([POCID] = ?)"
OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:SessionParameter Name="POCID" SessionField="User_ID" Type="Int32" />
</SelectParameters>
</asp:AccessDataSource>


I've tried each without success,
1. changing the DataFile to the complete path and every other variation
2. changing the "/" in the path to "\"
3. giving folder and file permissions to
a. NETWORK SERVICE
b. ASPNET
c. Internet guest account
d. IIS Process Account
e. Everyone

I also tried changing the Enable/Disable anonymous access method and turn on/off Integrated Windows
authentication in the Web Site properties. None of these fixed the error.

Anyone have a solution to this problem?

wmsutton


Assuming the database is on the same machine as the web server I would highly recommend using a full path name to the file.

A couple of other questions, what level of authentication is your web application configured for? Is impersonation enabled?




Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV

I've tried using the full pathname but that didn't work.

I'm using Integrated Windows authentication and don't have impersonation enabled. Both the database and ASP.NET application are on the same Windows 2003 Web server. I didn't change the default on the server, ASP.NET is executing under the NETWORK SERVICE account.

Also, I'm able to access the database with C# from some code-behind on one of the .aspx pages. I use the ConnectionString from the web.config and an OldDbConnection.

wmsutton


Under this scenario the local NetworkService account will need full permissions to the folder where the Access database is located.

Now if you're able to work with the database via code then that would indicate there's a problem with how you're connecting with the DataGridView.




Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV
what access rights did you give to the folder?

The account running the ASP.Net application needs edit rights to the folder with the MDB because it needs to create the record-locking LDB file in the folder.
If you give edit rights to the everyone group it is the easiest solution, but not the most secure.

Also make sure the MDB file is not read-only.
kbradl1
reply 5

You can use google to search for other answers

 

More Articles

• SQL select with variable or an object
• SqlRowsCopied event in SqlBulkCopy + .NET 2.0
• Should I reinstall?
• How to create a web services for retrieving Microsoft Access Data...
• An error has occurred while establishing a connection to the serv...
• ComputerEase ODBC Date Insert/Update problem
• DataTable.Load() Generates InvalidOperationException
• Having problem with Fill() method
• SQLCommand insert not working for dataset with more than one row.
• DataGridView vs DataGrid vs VB6 DataGrid
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Help C# SQLTABLES
• OleDbCommandBuilder doesn't generate any
• ComputerEase ODBC Date Insert/Update pro
• How to get headers only from column name
• Adding a Primary Key column to a disconn
• How to perform a case insensitive filter
• Data type mismatch in criteria expression
• oracleCommand error
• ms exchange alldayevent error
• Query a View
• Problems deleting a record.
• Images from the database
• ASP.Net worker process can't accessing O
• TableAdapter Update problem
• Desiging Data Access

Hot Articles

• XML Schema Help with FIX 4.4
• access sql server database with vb
• need help inserting into a dbf file
• How to schedule a windows service for ev
• Nobody can answer this question!
• Store/retrieve Avi files to/from Sql Ser
• .Net 2.0 Web App linking to SQL 2000
• Deny access to all my .mdb in a directory
• Query about DataSet
• Merging two datatables with different co
• Inserting into two sql tables at the sam
• Exception: DataTable internal index is c
• Updates Using the Entreprise Library DAAB
• Confused on the setup of VS with SQL Ser
• Requesting a list of datasources in vs 2

Recommend Articles

• datatable column name and datatype
• SqlDataReader.Close or .Dispose results
• How can I save textbox with value in the
• How to get the max length of text field
• DataTable - Null Object Reference Error
• OLEDB + SQL
• SQLExpress - SQLDataAdapter Conflict
• Bug with DeriveParameters?
• Data Relation Causing a Performance Hit???
• Optimizing data transfer and storage whe
• Combo Boxes and RecordSet
• SQL Table Lookup Methods
• Isolation.ReadUnCommitted Locking Proble
• OleDbPermission
• Transaction