下面这个方法可以获得当前登录域的用户名
using System;
using System.EnterpriseServices;
public string WhoIsCaller()
{
string retVal = "Unknown caller (Security is not enabled)";
if (ContextUtil.IsSecurityEnabled)
{
SecurityCallContext sc;
// CurrentCall is a static property which
// contains information about the current caller
sc = SecurityCallContext.CurrentCall;
// retrieve the current caller account name
retVal = sc.DirectCaller.AccountName;
}
return retVal;
}
其他的可以看看SecurityCallContext的成员
改用户信息是Admin的工作,既然是Admin,用AD用户管理来编辑不就行了,何必用你的程序。再说,这是系统级的东西,在应用程序这一级,恐怕没权限吧。
可以用role-based security来管理应用程序的用户,这是很flex很power的