开发者

Membership.GetUser() advisable to use?

开发者 https://www.devze.com 2023-04-06 07:34 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消