Is it possible to change the username with the Membership API

It’s true that the default SQL Membership Provider does not allow username changes. However, there’s no intrinsic reason to prevent users from changing their usernames if you have a valid argument, on your site, to allow it. None of the tables in the SQL database have the username as a key, everything is based on … Read more

How to combine using Membership API with own application related data?

The first is the simpliest approach. Add the GUID of the user as a foreignkey in the related tables (f.e. Ordered_by). I don’t see where it breaks separating concerns. If you want to keep the order-record in database, you also have to keep the user who has ordered, that makes perfectly sense. I have used … Read more

Entity Framework: how to solve “FOREIGN KEY constraint may cause cycles or multiple cascade paths”?

You can use the fluent api to specify the actions the error message suggests. In your Context: protected override void OnModelCreating( DbModelBuilder modelBuilder ) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<aspnet_UsersInRoles>().HasMany(i => i.Users).WithRequired().WillCascadeOnDelete(false); } Note that you have not included the definition for the table aspnet_UsersInRoles so this code may not work. Another option is to remove all CASCADE … Read more

When the same user ID is trying to log in on multiple devices, how do I kill the session on the other device?

I came up with a pretty awesome solution to this. What I’ve implemented was when user “Bob” logs in from their PC, and then the same user “Bob” logs in from another location, the log-in from the first location (their PC) will be killed while allowing the second log-in to live. Once a user logs … Read more