开发者

Membership.GetUser() vs Context.User

开发者 https://www.devze.com 2022-12-28 08:04 出处:网络
What are the differences between Membership.GetUser() and Context.User, and which is recommended for use in getting information ab开发者_StackOverflowout the current user?If you don\'t have membership

What are the differences between Membership.GetUser() and Context.User, and which is recommended for use in getting information ab开发者_StackOverflowout the current user?


If you don't have membership configured for your site, getuser() won't yield anything.

Context.user is the identity token handed to the asp.net runtime, and will yield a user if any authentication aside from anonymous acces is configured fo the site.


Membership.GetUser implies the use of a MembershipProvider. It simply retrieves user information from whatever store is configured. (e.g. ActiveDirectory, SQL Server). Context.User is the IPrincipal security context for the current Request.

0

精彩评论

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

关注公众号