Membership.GetUser() advisable to use?
I need GUID (UserId) at many places in my application. Currently I am making calls to Membership.GetUser()
to get the UserId. Does this method make a database call or it caches the details?
If it makes a database call then it is better to store in Session. Any hints开发者_Go百科?
The Membership.GetUser()
method gets the information from the data source and updates the last-activity date/time stamp for the current logged-on membership user.
You might want to implement IIdentity
with a UserId property so it will be part of the authentication ticket..
Yes it does make a call to the database, best thing to do as soon as you authenticate your user you can then use session to stored userid.
精彩评论