.Net Membership

Soldato
Joined
18 Oct 2002
Posts
4,925
Location
Yorkshire
Playing about with the Membership/User/Roles Classes at the moment and i'm trying to setup a custom update user page. Managed to get everything setup but now i'm wanting to make it possible to change the user UserName.

Unfortunately Microsoft has decided to make this property ReadOnly. Been looking on the net and it appears the only way to get round this is to use a stored procedure and change the UserName in the User table directly.

The problem now is this works fine for users who arn't already logged in but if there currently logged in this is messing things up as there current authentication sessions has them logged in as the old username so when they view a page which queries the user Object it falls over as that user name no longer exists.

The only way I can see to get round this is to either:
1) add some validation to the update user page which prevents users from changing the loginName of currently logged in users
2) Force the user being updated to be Logged out (don't like the sounds of this apart for if i'm updating my own userName)

Anyone else run into a similar problem? any suggestions on how best to tackle this ?

At the moment i'm thinking of just going with option (1) and preventing the updating of Usernames for currently logged in users , and if its your own user name just throw up a warning that it'll result it them being logout out.
 
Invalidating the current user's session on a username change actually sounds like desirable behavour in most conditions, so I suspect this is by design. Also depending on the size of the system practically I don't think you'll get many occations where you'll need to change the username of an active user (I've never come across one so far, but I've only used the membership stuff a couple of times).

akakjs
 
Back
Top Bottom