Thursday, April 14, 2005

Connecting to Access mdb from ASP.NET

A lot of newbies are facing security problems, when they try to connect to a Microsoft Access Database ( mdb file) from ASP.NET, using oledb. This is because, the ASPNET user account in Windows doesn't have security access to the mdb file by defualt. ASP.NET uses the ASPNET user account for connecting to the database. To solve this,

  • Right click the Access database file, click properties.
  • Click the security tab in properties dialog box.
  • Add the user ASPNET to the security list, and provide full control (check allow full control checkbox)
  • If you can't see the security tab when you take properties, it is because 'simple file sharing' is enabled by default. Use windows explorer->Tools->Folder Options to disable simple file sharing.

1 comment:

Travis Smith said...

Thank you!! Giving the localmachine\ASPNET account permissions to the access DB was the final piece of the puzzle. I had all the code working under SQL Server and just wanted to move to MS Access to keep it cheap for the client. It wasn't as easy as changing from SQL to OLE in the code, like I thought it should be.

Sooner or later, this .NET stuff will all make perfect sense to me. :)

Articles - Design Patterns, Neural Networks, C#, Programming