locked
Where are users&roles stored? RRS feed

  • Question

  • Where are users/roles stored when we enable form authentication?

    (I enabled forms authentication on an external database from an sql server 2008. Also the application is multi user at a server/client model)

    Monday, February 28, 2011 10:40 AM

Answers

  • They are stored in a local SQL Express database during development, the same database that tables are created in when you create new tables through the LightSwitch IDE.

    • Marked as answer by tsiakk Tuesday, March 1, 2011 7:19 PM
    Monday, February 28, 2011 1:20 PM
  • It depends on how you publish the LightSwitch app.  If you decide to publish directly to the server, the database containing the users and roles tables will be generated on that server.  Or you could publish to a SQL script file.  In that case, the the database containing the users and roles tables will be generated when the script is run. 

    • Marked as answer by tsiakk Tuesday, March 1, 2011 7:19 PM
    Monday, February 28, 2011 2:38 PM
  • Also, be aware that during development if you add users and roles to the application, these will not be deployed with the application.  No data is ever deployed with an application, just the schema.  Adding users and roles during development is really just for testing purposes. 
    • Marked as answer by tsiakk Tuesday, March 1, 2011 7:19 PM
    Tuesday, March 1, 2011 1:25 PM

All replies

  • They are stored in a local SQL Express database during development, the same database that tables are created in when you create new tables through the LightSwitch IDE.

    • Marked as answer by tsiakk Tuesday, March 1, 2011 7:19 PM
    Monday, February 28, 2011 1:20 PM
  • i will detach and attach my external database when i will move it to my client's server.how can i also transfer the users and roles to my clien't server?
    Monday, February 28, 2011 2:31 PM
  • It depends on how you publish the LightSwitch app.  If you decide to publish directly to the server, the database containing the users and roles tables will be generated on that server.  Or you could publish to a SQL script file.  In that case, the the database containing the users and roles tables will be generated when the script is run. 

    • Marked as answer by tsiakk Tuesday, March 1, 2011 7:19 PM
    Monday, February 28, 2011 2:38 PM
  • Also, be aware that during development if you add users and roles to the application, these will not be deployed with the application.  No data is ever deployed with an application, just the schema.  Adding users and roles during development is really just for testing purposes. 
    • Marked as answer by tsiakk Tuesday, March 1, 2011 7:19 PM
    Tuesday, March 1, 2011 1:25 PM
  • Hi,

     

    could you please tell us, WHERE all those information are stored? I can't find any file or database on my computer.

     

    I used SQL Server Management Studio and there is no Database on my which is used by LightSwitch for storing authentification.

     

    Also where can I specify that LightSwitch should not use its own database, but my database where all other data is stored too?

     

    When I use "Add Table" instead of "Add Data Source" in my project, where are all those tables stored? I can't find any file or database on my computer.

    Wednesday, April 27, 2011 9:30 AM
  • Hi Sascha,

    The users, roles and tables added using 'Add Table' are saved in the intrinsic (Application Data) database.

    You can find this database by opening the contents of your LightSwitch project in Windows Explorer and navigating to the following path:

    /Bin/Data/ApplicationData.mdf

    You'll need to 'attach' this mdf file in SQL Server Management Studio.

    Tim

    Wednesday, April 27, 2011 10:11 AM
  • Thanks :-)

     

    And how can I force storing the user accounts and tables in my SQL Database instead of this file?

     

    By the way: I used the Publish Wizard and used all default settings. Then I clicked on the .application so that the One-Click-Installation started. I did not understand why the client was working then and was storing the new user accounts I added. Where is the server running? And where is the mdf File now? In the Publish folder was no mdf-File.

    Wednesday, April 27, 2011 2:43 PM
  • Thanks :-)

     

    And how can I force storing the user accounts and tables in my SQL Database instead of this file?

     

    By the way: I used the Publish Wizard and used all default settings. Then I clicked on the .application so that the One-Click-Installation started. I did not understand why the client was working then and was storing the new user accounts I added. Where is the server running? And where is the mdf File now? In the Publish folder was no mdf-File.


    Sascha, as Matt previously mentioned in this thread, all the user_role_permission details are stored in mdf file during development. You cannot force it to store in some other place. Once you publish, this data will not be available. You will have to create users and roles, and assign roles to users.

    I would suggest you to go through the following two tutorials:

     

    Please let me know if you need any specific details for your publish scenario.

     

    Wednesday, April 27, 2011 4:11 PM