Link to home
Start Free TrialLog in
Avatar of Ok123
Ok123Flag for Belgium

asked on

How to use aspnetdb.mdf on my production server

HI,
I would like to protect some pages in my asp..net web site.

I tried with a very simple project with one default page, a login.aspx page and a protected folder( with one page).
Vs (express) created a aspnetdb.mdf file.

On my local environnement it works fine but when i try to move to my hosting solution (arvixe) , nothing is working anymore.
I guess the problem is when the login form try to read informations in the aspnetdb.mdf.
i add a connection string in my web.config but i am not sure it's the right way...

Someone could help me to solve the problem ?
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

A little more clarification is needed.  I assume you are using SQL Express and IIS?  Or are you using an Access database?

You can not just copy a *.mdf from 1 server to another.  For a direct copy, you first must detach the database from SQL Server (using SQL Server Management Studio), transfer the *.mdf file to the new server (which needs to have some form of SQL Server running), then attach the database and verify that the db is online.

Then, if your IIS is configured and running correctly, you should be in business.

Dan
Avatar of Ok123

ASKER

Hi ,
I am working with VS Studio 2012.
I am not working with access.
The aspnetdb.mdf is generated by vs when you add a login control in a asp.net login page.

The problem is to connect that db when i work on my production server.

Regards
Then the question is, do you have an instance of SQL Server or SQL Express installed and running on the Prod server?

VSExpress installs SQL Express during its installation process, which is why you can use a SQL database on your local device.

1. download SQL Server Express with management tools (SSMS)
2. install it on your prod server
3. attach your database as noted above.

I would recommend first trying this on a replica of your production server.  I would verify all the software that is installed/running on your prod server before dropping a SQL engine on it.

Dan
Avatar of Ok123

ASKER

yes i have a sql server on the prod server.
It's an Arvixe shared hosting.
So then, I would follow the steps mentioned above.  Do you have console access to the server?

Here is a link describing the concept of detaching/attaching a database file.:  http://technet.microsoft.com/en-us/library/ms190794(v=sql.110).aspx
And here is a link to connection strings for asp.net apps:  http://msdn.microsoft.com/en-us/library/jj653752(v=vs.110).aspx#sse

BTW:  "Arvixe shared hosting" doesn't mean anything.  It gives no context as to what you have on your production server.

Dan
ASKER CERTIFIED SOLUTION
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial