Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 25, 2013 03:18 AM by Chen Yu - MSFT
Jan 18, 2013 04:24 PM|LINK
How are you?
I am trying to make a "user information" page in my website. I am using "CreateUserWizard"(visual Studio's own) And as you know it creates a database called "ASPNETDB" which includes the information about memberships. ON my page's code-behind section I
have this code: SqlDataSource1.SelectParameters.Add("UserId",
This code is for selecting only the USER's informaiton. But When I click on the page it gives an error
Unable to open the physical file
"the Db's directory" Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". An attempt to attach an auto-named database for file C:\Users\my name\Documents\Visual Studio 2012\WebSites\Blog\App_Data\ASPNETDB.MDF
failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
This really annoys me :/ How can I fix it? I am waiting for your helpful answers.
Have a great day!
Jan 18, 2013 09:59 PM|LINK
Are you using IIS. Try ti assign full permissions to that folter for the Netowrk Service account.
Jan 19, 2013 08:56 AM|LINK
First thank you for your answer. What do you mean by IIS? an how can I give full access? I found the problem. I think it is about the "users" permissions.(I eman the users in the website. Not windows one) How can I give them access permission to the database.?
When I try to open the page without logging in to test the data it gives the data and works properly. But when I login and go to the page again it gives the same error above :/ I think I must give these users a permission to access the DB. But how can I do
that? And does this create a security problem in the future?!!
I am waiting for your answers. THANKS!
Jan 21, 2013 10:55 AM|LINK
Oh, now i see that your project is located in C:\Users folder. Try to move it to D:\ if you have such drive or give permissions to the current folder. The problem is related to permissions the the folder, where is located your database.
Jan 24, 2013 05:21 AM|LINK
Please make sure the user account that you use in the project has enough permission to access C:\Users\my name\Documents\Visual Studio 2012\WebSites\Blog\App_Data\ASPNETDB.MDF. You could follow below article to grant permission.
Jan 24, 2013 01:02 PM|LINK
First of all thank you for you great answers! Now will try to change security permissions etc. But I want to ask you something. After I fix this problem will there be such an error when I completed my project and deployed it? And for the user account you
mean "Windows" one or the user on the webpage? My windows account has permissons but I don't know how to give the permissions to the users on the website project. Maybe I am going something wrong with "select" query but I tried a lot of queries and it gives
and error about "unable to open the pyhsical file..." not about sql connection. I tried to change aspnetdb with another sql database but still gives the same error. I am waiting for your answers!
Thank you so much!
Jan 25, 2013 03:18 AM|LINK
After I fix this problem will there be such an error when I completed my project and deployed it?
Would you please tell us which error occurred when you completed my project and deployed ?
And for the user account you mean "Windows" one or the user on the webpage?
I mean the user account you use to execute your project. Generally, it's your current windows account. If you use run as administrator, it will use administrator account.
You could reference on this thread: