attach database - access denied

I'm using Sql Server Express 2008 and I'm trying to attach a datbase .mdf file that is located in the app_data folder of a web application in my development environment.

When I try and attach the database, I get the following error message:

Unable to open the physical file "C:\My Documents\Visual Studio 2008\Projects\Security\Projects\Web App\Security\App_Data\Security.mdf". Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)

I tried to add the ASPNET user to the directory, but the ASPNET user was not listed?  How can I resolve this issue and get the database attached.

Who is Participating?
Coralie CrumrineConnect With a Mentor Commented:
You need to open SQL Express by right clicking on the shortcut and saying "Run As Administrator".  Once you open it that way, you will be able to attach the database no problem.
To avoid having to right click every time, Right click on the shortcut, choose Properties, Click on the Compatiblity Tab, check the "Always Run as Administrator", click OK.
-Dman100-Author Commented:
Thank you!  Worked like a charm.
All Courses

From novice to tech pro — start learning today.