locked
ASPNETDB.MDF RRS feed

  • Question

  • User-1773948845 posted

     

    I am creating a new application and want to store the sql database. But i need the aspnetdb.mdf. I dont know where is the database located or do we have any scripts to create the database.

    Any help would be useful

     

    Thursday, January 31, 2008 2:23 AM

Answers

  • User1827201912 posted

    Hi,

    Read this explanation by Jos.

    ASPNETDB.mdf is the database for the membership provider (and other providers too). It is automatically attached to the SQLEXPRESS server on the webserver when a user tries to authenticate, and it is detached automatically when it is no more needed. This is called a user instance.

    This will fail when it is already attached in another way, e.g. when it is attached in Visual Studio or Visual Web Developer. Maybe that's your problem? You can detach it in Visual Studio by right clicking on it in the Solution Explorer or in the Database Explorer. Always detach it in VS before you try to use the database in the website. For connecting to a database, it needs to be attached to the server first.

    Attaching means that the database file is "connected" to the SQL server, and it is given a database name. From then on, you can open the database through its name, you don't need to know its location on the disk. The usual procedure is to use a database that is attached permanently. ASPNETDB.mdf is a database that is only attached "when needed".

     

    HTH,
    Suprotim Agarwal

    -----
    http://www.dotnetcurry.com
    -----

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 31, 2008 4:17 AM

All replies

  • User370194836 posted

    Hello Jai,

    You can use the aspnet_regsql.exe tool (http://msdn.microsoft.com/en-us/library/ms229862(VS.80).aspx)

    Regards,

    George

    Thursday, January 31, 2008 3:01 AM
  • User1834899941 posted

     

    I am creating a new application and want to store the sql database. But i need the aspnetdb.mdf. I dont know where is the database located or do we have any scripts to create the database.

    Any help would be useful

     

    You can find the .MDF file and the .LDF file in ../Program Files/{Sql Server Directory}.

    Copy both the .MDF and .LDF files and you can paste it in your App_Data directory of your project.

    ---------------------------------------------

    Click Mark As Answer if this helped in resolving your problem.

    Thursday, January 31, 2008 3:53 AM
  • User1827201912 posted

    Hi,

    Read this explanation by Jos.

    ASPNETDB.mdf is the database for the membership provider (and other providers too). It is automatically attached to the SQLEXPRESS server on the webserver when a user tries to authenticate, and it is detached automatically when it is no more needed. This is called a user instance.

    This will fail when it is already attached in another way, e.g. when it is attached in Visual Studio or Visual Web Developer. Maybe that's your problem? You can detach it in Visual Studio by right clicking on it in the Solution Explorer or in the Database Explorer. Always detach it in VS before you try to use the database in the website. For connecting to a database, it needs to be attached to the server first.

    Attaching means that the database file is "connected" to the SQL server, and it is given a database name. From then on, you can open the database through its name, you don't need to know its location on the disk. The usual procedure is to use a database that is attached permanently. ASPNETDB.mdf is a database that is only attached "when needed".

     

    HTH,
    Suprotim Agarwal

    -----
    http://www.dotnetcurry.com
    -----

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 31, 2008 4:17 AM