What is the recommended solution for keeping track of the current user in a site using OpenId? Say I have a Users table with an id and a claimed identifier and then my site specific info and the user wants to update their site specific info. What is the best way to track the current user given that I am not using the built in membership? Should I send a request to openid to get the ClaimedIdentifier each time a user attempts to update their profile? Or perhaps just enforce a UserName be unique and get the user’s info based off of User.Identity.Name?
Share
I do it with a cookie :)… you might find my answer useful: What OpenID solution is really used by Stack Overflow?
I’ve also made a simple blog post about it: http://codesprout.blogspot.com/2011/03/using-dotnetopenauth-to-create-simple.html
In my example I signed in with the OpenID and I stored it in the cookie, but you can store other information in the cookie, such as the user name:
Update 2.0:
How about something like this (this is the View):
And the Controller, presumably you’re taken to a
Profilepage after you log in (or you could set theResponse.Cookiesin theLogInmethod) and when you’re loading up the model you set the display name in the cookie:You can see it all in action on a little project I have: mydevarmy. I’m going to post a user profile soon and you will be able to change the display name (which is automatically generated for now).