aspnetDb Database Questions

Discussion in 'Databases' started by davisapdevc, Dec 11, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi, I am new to DiscountASP.Net and would like some information about how to use the aspnetDb database.

    As suggested in severalforum postsand one kb article I believe you should follow the steps below to create the database, create users and roles and upload the database to DiscountASP.
    1. On your local development machine, create a local aspnetDb database in sql server - not using the wizards in Visual Studio, rather using aspnet_regsql.exe
    2. Use the local Web Site Administration tool to create the users and roles.
    3. Detach the local aspnetDb database from the local sql server.
    4. Copy the local aspnetDb.mdf file to the root directory of the local copy of the website (or to ~/App_Data/aspnetDb.mdf).
    5. Publish (or copy the website via ftp) to DiscountASP
    6. Use the SQL Tools on the DiscountASP to attach the data file to the DiscountASP SQL Server. (In the article describing this process, it indicates that this will overwrite the existing database)

    So I would like more information on the following:
    1. Is there a complete step-by-step article for performing this procedure?
    2. Will the above procedure work?
    3. If I copy the aspnetDb.mdf file to replace the current database, as I believe this procedure will do, will my database still have the same name that was assigned to me when I purchased the add-on? Will the users that I added to the aspnetDb still exist in the database after I attach it to DiscountASP?
    4. How does this affect the users that I have already created in the current database?

    Thanks in advance for any help.
     
  2. Firstly,the procedure you mentioned will work fine.If you use the 'SQL Tool Suite; to attach aspnetDb,it will copy over all the users/roles you created using the 'Site Admin Tool'.But ,attaching it will overwrite the exisiting schema in your existing database(current database).And yes,the name of the database will remain the same that was assigned to you.

    You can use the asp_regsql.exe to create aspnetDb schema remotely,rather than copying the DB and then attaching it later.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Thank you, Vikram, your suggestion to create the schema remotely worked great. There was no need to copy the database.

    I have written the procedure that I used, below, so someone else may not have the same issues that I have had with this:
    1. Use SQL Server Management Studio to connect to the DiscountASP database.

    2. Using the following commands from the command line, create the aspnetDb database schemain the DiscountASP database:
    a. On your local machine, run the following DOS command from the command line: cd\WINDOWS\Microsoft.NET\Framework\v2.0.50727
    b.Then run the following command: aspnet_regsql.exe -S [DB Server Name (Data Source)] -U [DB Login (User ID)] -A all -P [Password] -d [Database name (Initial Catalog)] This will create the aspnetDb schema in the DiscountASP database on the remote server.

    NOTE: In this procedure, the server/database you are connecting to is the remote DiscountASP server and database, not your local server and database, although you are performing the procedure from your local machine.

    3. Use the local Web Site Administration tool to create the users and roles. To do this, open the local copy of the web application in Visual Studio 2005 (or Visual Web Developer). Then open the web.config file and enter the following in the ConnectionStrings section (You may have to create the entire section, if it does not exist, already):
    <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer"
    connectionString="Data Source=[DB Server Name];
    Integrated Security=False;
    Initial Catalog=[Database name];
    User ID=[DB Login];
    Password=[Password]"
    providerName="System.Data.SqlClient" />
    </connectionStrings>

    kb article Q10413 gives a good outline of this entire procedure.

    Next, from the menu in Visual Studio, choose ASP.Net Configuration. This opens the ASP.Net Web Site Administration tool. Use this tool to create users, roles, etc. Make sure you choose Connect From the Internet as the authentication method. This automatically uses Forms authentication and creates the necessary entries in the web.config file. An explanation of how to use this tool is contained in kb article Q10413, also.

    4. Then run the web applicationfrom your local development machine to make sure the logins all work, correctly.
    5. Publish (or copy the website via ftp) to DiscountASP
    6. Check everything, again to make sure all is working correctly on the remote (DiscountASP) web server.

    Again, thanks to Vikram for pointing out to me that I could use the aspnet_regsql tool from my local development machine. This saved having to create the aspnetDb database on my local machine and copy it to DiscountASP.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page