Search code examples
asp.netspacesmembership

ASP.NET membership spaces in username


We just came across a weird bug in our application that uses the asp.net membership.

The administrator had created some users with spaces behind their name: 'My Username ' In the Users table this is saved normally, so without the spaces: 'My Username' The user can also login using the name without the spaces: 'My Username' When we use User.Identity.Name in our applicatie the result is the username WITH the spaces: 'My Username '.

Where do these spaces come from? They aren't stored in the Users table so where does he get this from?!


Solution

  • How are you determining that it isn't stored in the DB with the space at the end? Are you sure the SSMS isn't just hiding it from you?