下面这个方法可以获得当前登录域的用户名
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的
解决方案 »
- BaseFrom加载另一个form的问题
- 高分
- 登陆问题
- 请问C#中自带报表的用法??
- double类型保留两位小数的问题,如果是 111.001,用System.Math.Round,结果是111.0,求助
- C#大旗下的彩信开发,高手指点
- 怎样获取当前运行的所有线程????
- 急!急!用vs.net2003制作的安装程序安装完毕后,在程序菜单里没有快捷方式
- 关于抓取网页回帖信息的问题请教
- 程序中:private System.ComponentModel.Container components = null;起到什么作用?在什么地方用到?
- C#中关于系统托盘的问题
- 各位大侠帮忙啊!!!!!!!!!!!!!!!!!!!
最简单的方法:
MessageBox.Show(System.Environment.UserName);