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.
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.