Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a database in one of my Visual Studio Express projects. I want to attach it to my local SQLEXPRESS instance so I can run aspnet_regsql on it and add the membership database. When I select Attach Databases and then attempt to browse to the files (C:\Users\username\Documents\Visual Studio 2010\Projects\nameofproject) it only lets me navigate to C:\Users\username...Why? How can I fix this?

share|improve this question
    
have you succeeded in doing so ? i don't under stand how to do what @mrdenny explained –  eran otzer Dec 13 '11 at 1:04
add comment

3 Answers

up vote 5 down vote accepted

This is because SSMS isn't the application which is getting the folder list. SSMS asks the database to do this as SSMS doesn't know if the database is local or remote, so it always has the SQL Server do the work. The SQL Server probably isn't running under your user account so it didn't have access to your home directory.

If you give read access to the user account the SQL Server instance is using, you will be able to browse the directory.

share|improve this answer
    
how do you grant read access to your user account , after performing some Google searches i came accross some non-related references to that affect . –  eran otzer Dec 13 '11 at 0:53
    
The easiest way is to make what ever account which the SQL Server on your workstation is running under an admin on your workstation. Failing that navigate to c:\users\username and right click on username and select properties. Then add the account which the SQL Server is running under with full control of the folder. That or move the database to an unprotected location. –  mrdenny Dec 13 '11 at 16:52
add comment

Instead of giving all users access to your personal files/folders, just change the SQLExpress Windows service to start with your credentials instead of the default Network Service ID.

share|improve this answer
    
This usually isn't the best idea if the user changes his password he'll have to change the start up account for the SQL server as well. –  mrdenny Dec 13 '11 at 16:53
add comment

I figured it out. Despite the fact that I have turned off UAC on my machine and run the MSSMS application as administrator I still cannot navigate into my documents folder - its apparently using a non-privileged user to browse the folders. I ended up giving Users list folder contents permissions to my username, my documents, visual studio 2010, etc. and then full permissions to the actual project...this worked.

share|improve this answer
    
asp.net always uses a "non-priviledged user", in case of security hole in your web site. You also shouldn't point your site to look for a database anywhere like "C:\...". Use the App_Data folder in your site instead. –  Joel Coehoorn Jul 25 '10 at 0:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.