得到当前用户的几种办法

在有些时候,我们需要知道登录当前页面的用户是谁,下面是几个使用过的方法,也有从网上搜刮来的。
1.
得到当前用户的几种办法
文章图片
得到当前用户的几种办法
文章图片
Code
SPWeb web = SPControl.GetContextWeb(Context);
SPUser currentUser = web.CurrentUser;
2. 得到当前用户的几种办法
文章图片
得到当前用户的几种办法
文章图片
Code
System.Security.Principal.WindowsIdentity.GetCurrent().Name //这个是从网上搜刮来的 3. 得到当前用户的几种办法
文章图片
得到当前用户的几种办法
文章图片
Code
System.Web.HttpContext.Current.User.Identity.Name 大家要是有什么其它的办法,也来分享一下。 【得到当前用户的几种办法】转载于:https://www.cnblogs.com/jdxyw/archive/2008/11/27/1342025.html

    推荐阅读