5 pts.
 connecting to SQL server with mdf files
What is the best way to connect a website on a VPS to sql server 2008 R2 express, using MDF files as databases. The VPS is running on server 2008 R2. I installed the same environment on the development computer. IIS gets a connection because it sees the users that are in the ASPNETDB.MDF file. (Beside that I have another database.) But as soon as I run the website and try to log in, the application crashes. I tried using integrated security and user instance in the connectionstring in the webconfig file, but get the error that the user instance could not be created. I made a user in sql server but that user can only be linked to existing databases (so MASTER) and when logging in to the website i get the error that ASPNETDB.MDF could not be created in the MASTER database because that file already exist (so this would be completely wrong). So how can I connect it in the right way? I would rather keep on using MDF files in the App_Data directory of the website, but is that a good thing? Is it secure on the VPS?

Software/Hardware used:
see tags
ASKED: September 24, 2011  12:52 AM
UPDATED: March 31, 2012  1:16 AM

Answer Wiki:
Storing the database in the App_Data directory usually isn't the best idea. It wouldn't be all that hard for someone to download the database from the website. Instead of having the AttachDbFilename parameter in there, simply attach the instance to the SQL Server and connect to it like a normal application would.
Last Wiki Answer Submitted:  September 26, 2011  2:00 am  by  Denny Cherry   64,550 pts.
All Answer Wiki Contributors:  Denny Cherry   64,550 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _