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",
Context.User.Identity.Name).
This code is for selecting only the USER's informaiton. But When I click on the page it gives an error
like this:
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.
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?!!
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.
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.
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!
After I fix this problem will there be such an error when I completed my project and deployed it?
Hi,
Would you please tell us which error occurred when you completed my project and deployed ?
Mac14
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.
Mac14
Member
46 Points
71 Posts
Connection Problem With ASPNETDB.MDF
Jan 18, 2013 04:24 PM|LINK
Hello Everyone!
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", Context.User.Identity.Name).
This code is for selecting only the USER's informaiton. But When I click on the page it gives an error like this:
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!
B.Alexandrov
Member
232 Points
41 Posts
Re: Connection Problem With ASPNETDB.MDF
Jan 18, 2013 09:59 PM|LINK
Are you using IIS. Try ti assign full permissions to that folter for the Netowrk Service account.
Thanks.
Mac14
Member
46 Points
71 Posts
Re: Connection Problem With ASPNETDB.MDF
Jan 19, 2013 08:56 AM|LINK
Hi alexandrov
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!
B.Alexandrov
Member
232 Points
41 Posts
Re: Connection Problem With ASPNETDB.MDF
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.
Thanks,
Chen Yu - MS...
All-Star
21600 Points
2493 Posts
Microsoft
Re: Connection Problem With ASPNETDB.MDF
Jan 24, 2013 05:21 AM|LINK
Hi,
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.
Please see: http://technet.microsoft.com/en-us/library/bb727008.aspx
Best Regards,
Feedback to us
Develop and promote your apps in Windows Store
Mac14
Member
46 Points
71 Posts
Re: Connection Problem With ASPNETDB.MDF
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!
Chen Yu - MS...
All-Star
21600 Points
2493 Posts
Microsoft
Re: Connection Problem With ASPNETDB.MDF
Jan 25, 2013 03:18 AM|LINK
Hi,
Would you please tell us which error occurred when you completed my project and deployed ?
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: http://stackoverflow.com/questions/6347312/unable-to-open-the-physical-file-operating-system-error-32
Thanks.
Feedback to us
Develop and promote your apps in Windows Store