Is it possible to change the username with the Membership API

Bobby Ortiz picture Bobby Ortiz · Jun 16, 2009 · Viewed 23.3k times · Source

I am using the default sql membership provider with ASP.NET and I would like to provide a page to change the user's username. I believe I am sure I could do this with a custom provider, but can this be done with the default provider?

Second part of my question is: Should I allow users to change their username after the account is created?

Answer

Jonathan Freeland picture Jonathan Freeland · Jun 16, 2009

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 the user's ID, so from an implementation perspective it would be fairly easy.