locked
Change ApplicationID (aspnet_Membership)? RRS feed

  • Question

  • Hello,

    we use one Database for Authentication - now I have made a copy of our LS Project to have a reduce version of it for the extranet/internet...

    the problem that I have that this second LS App uses the same ApplicationID than the Internal Version and so both apps can see the users/roles from the other

    I have to change the ApplicationID from the new LS project - how to do this?

    robert

    Friday, December 7, 2012 11:03 AM

All replies

  • You'd have to manipulate the aspnet_* tables directly in the database that you use for authentication. I'm sure I don't need to tell you to make a backup before you attempt it. :-)

    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, December 7, 2012 11:55 AM
    Moderator
  • Hi Yann,

    what should I manipulate in that tables?

    in the aspnet_Applications I have one entry which represent my app with name/guid - the copy of my app "goes" to the same entry so there have to be a reference between this entry in the DB and the LS app?

    robert

    Friday, December 7, 2012 11:59 AM
  • Actually, the "link" is the ApplicationName attribute in the web.config table (found in the ServerGenerated project in V1, & in the Server project in V2).

    As long as both applications have the same application name, it's going to look up the same record, even if you do have a seocnd one.

    Here's a bit of background that may help:

    Always set the "applicationName" property when configuring ASP.NET 2.0 Membership and other Providers (note: this is done for you by LightSwitch)

    Introduction to Membership


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, December 7, 2012 12:24 PM
    Moderator
  • Hi Yann,

    thank you - that's the trick ;-)

    I'm very unlucky about the built in authentication because i don't have my own screens for add/change and also i need references between tables in my own DB and the aspnet_users table.
    I have done this now but it is a bad design in my opinion.

    do you always use the built in authentication in your apps or have you build a custom membership provider?

    robert

    Friday, December 7, 2012 12:32 PM
  • It's not really so much "bad design" as it is that you're doing something that wasn't originally intended (you'll hear me say that a lot, lol).

    LightSwitch inherits this from ASP.NET by the way, it's not a mechanism that the LS team created themselves. There are a number of little "quirks" in the underlying technologies that LightSwitch relies on, this is one of them.

    It's actually a good thing that the team didn't create all of their own technologies to do things though (as MS has so often done in the past). Instead they've used familiar & "best practice" technologies to build LightSwitch on (EF, MVVM, MEF, LINQ, ASP.NET, Silverlight, SQL Server, & now HTML5).

    All of what you described that you want to do ("my own screens for add/change and also i need references between tables in my own DB and the aspnet_users table") is possible with a RIA service. I recently built a screen (as a result of a question from Garth on how to unlock locked users), based on a RIA service that is itself based on the ASP.NET Membership API, to "unlock" users that have typed their password incorrectly more times than the allowed number of times (5, by default). I didn't want to have to go into the database tables each time to do it, plus it now allows me to view other membership properties (user's last log in time, who's currently online etc).

    A RIA service for your data grid's would also be useful to improve performance. I'm slowly converting all of my data grids to be bound to queries from a RIA service, instead of directly to entity queries. I can transport less properties from the server to the client (just the ones I want to display), plus I can do conversions & aggregations. Thanks to Xander for suggesting this method for lists/grids.

    Yes, I currently use the built-in membership provider. I also wanted to be able to add more properties to the User & Role tables (by joining with some of  my own tables), but I haven't had the time to master creating custom membership/role providers yet.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, December 7, 2012 1:18 PM
    Moderator
  • As I described in my post about the Datagrid Problem, it has nothing do do with my tables and it is not faster with a RIA Service but it is faster with another grid (FlexGrid from componentone) - so for me this looks like a problem with the speed of the LS Grid - if I use a list it is sooo much faster (but I need some columns)

    do you now an example of a custom membership provider?

    robert

    PS: do you know whats the problem with MainWindow_Closing event and writing to the DB:

    http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/3438317c-a36d-4363-93df-371260b52278

    Friday, December 7, 2012 1:25 PM
  • Also Robert, if someone provides a reply, that you feel answers your question, please remember to mark it as the question's answer.

    But don't feel obligated to mark "something" (or anything) as an answer though, only if you're happy with a particular reply. If a question hasn't been satisfactorily answered, it should remain unmarked, but if a question has an acceptable answer, it should be marked as such.

    We don't want moderators to have to come along & mark what they think is the answer to your question. I also don't like the idea of people self-proposing replies as an answer (especially straight away), so I don't do that, even if I think I've answered the question.

    Thanks.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, December 7, 2012 1:27 PM
    Moderator
  • Regardless of whether the List control performs better than the DataGrid control, RIA services can still be used to get better performance. Especially if people have computed properties &/or summary properties. If you choose not to go that route, that's up to you. I'm getting better performance now than I was getting before, so I'm happy.

    No, I still haven't gotten around to writing a custom membership provider.

    Implementing a Membership Provider

    Creating a custom membership provider

    Regarding the MainWindow_Closing propblem, I've answered in that thread.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, December 7, 2012 1:49 PM
    Moderator
  • Oh, & I meant to add..

    You can have multiple columns in a List control. Change the Summary control to a ColumnsLayout control, then add as many columns as you want.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, December 7, 2012 1:51 PM
    Moderator
  • I know - but the result that it is also as slow as the datagrid :-(
    Friday, December 7, 2012 1:54 PM