I’m currently working on a ASP MVC application. And was wondering if there is a way of changing HttpContext.Current.User.Identity.Name once the user has logged in.
I want to be able to do this to allow the user to change his/her username, and so need HttpContext.Current.User.Identity.Name to be changed once they have done that.
Any help would be great
I believe you can not do this:)
It is filled during authentication. Simpliest solution is when user changes username – log him out, and ask for login.
Update
It will work only with custom provider. If you are using standard one, i believe it can’t be changed at all.
As an alternative solution you can try to do next:
When user tries to change his name:
1. Create new user
2. abandon session
3. remove old user
4. change all data which related to user to a new account
5. log him in once again with new user.