View Single Post
  #7 (permalink)  
Old 05-05-2008, 18:10
Will Will is offline
Junior Member
 
Join Date: Jan 2008
Posts: 22
Default

Thanks to the help of Gabriel, my problem is now solved. Just to summaries the solution for anyone else who have had the same problem as me, and for those who are new to ASP.NET and using Microsoft Visual Web Developer 2008 Express Edition with SQL Server 2005 Express Edition too.

1. Create a blank database in Plesk and create a username and password for the database.

2. Download Microsoft SQL Server Management Studio Express.

3. When you start Microsoft SQL Server Management Studio Express, it will ask you to connect to a server name, by default, it is "COMPUTER\SQLEXPRESS", which I believe is to manage your own database locally. But for now, we just want to make a back up of the database.

4. Upload it to your web space.

5. Contact a helpful staff like Gabriel and kindly ask him to restore the backup to the blank database.

6. Use Microsoft SQL Server Management Studio Express and log into your database with your database username and password and check if all the tables etc... have been restored properly. (Now you can even mange your database remotely).

7. Change your connection string on your web.config:

<add name="ConnectionString" connectionString="Data Source=Server IP\SQLEXPRESS;Initial Catalog=Database Name;User ID=DB_User;Password=DB_PWD" providerName="System.Data.SqlClient" />

8. Add this to your web.config also:

<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=ABC"
connectionStringName="ConnectionString"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>

<profile>
<providers>
<remove name="AspNetSqlProfileProvider" />
<add name="AspNetSqlProfileProvider"
connectionStringName="ConnectionString"
applicationName="/"
type="System.Web.Profile.SqlProfileProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=ABC" />
</providers>
</profile>

<roleManager>
<providers>
<remove name="AspNetSqlRoleProvider" />
<add name="AspNetSqlRoleProvider"
connectionStringName="ConnectionString"
applicationName="/"
type="System.Web.Security.SqlRoleProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=ABC" />
</providers>
</roleManager>


9. COMPLETE. It should work now.

However, I still have a few questions:

*** On step 8, Gabriel helped me to add those codes to my web.config, but why didn't Visual Web Developer add it for me automatically when I created my web application locally? It worked without those codes when I tested it locally, so why do I need to add it when I put my website hosting online?

*** By default, the ASP.NET Web Web site hosting Administration Tool helps users to create user accounts by creating a database called ASPNETDB.MDF that works with the Membership class.

Now I tried to change the name of this database in Visual Web Developer, but it wouldnt let me, when I change it, it automatically changes it back to the default name which is ASPNETDB.mdf, does anyone know the reason for this? Does the ASP.NET Web Web site hosting Administration Tool require the database to be called ASPNETDB.MDF in order to work?


Cheers for the help again.

Last edited by Will; 05-05-2008 at 21:36.
Reply With Quote