English 中文(简体)
如何发现哪一个Windows账户正在运行一个.net应用程序?
原标题:How to detect which Windows account is running a .net application?

I m 撰写一个共用网站。 记录将记录输入档案(通过使用简化程序)。 但是,只为那些其账户是网站主机上管理人的用户书写标识。 我想发现哪些因素(可能不是使用SPUser)正在执行网络部分代码,以便我能为不太受欢迎的用户生成标识。 这是可能的吗?

增 编

最佳回答

这种幻灯将让用户所属的群体。

var id = System.Security.Principal.WindowsIdentity.GetCurrent();
IdentityReferenceCollection irc = id.Groups;
foreach (IdentityReference ir in irc)
     Console.WriteLine(ir.Value);
问题回答

有一些办法可以得出同样的结果:

  • Request.LogonUserIdentity
  • HttpContext.Request.LogonUserIdentity
  • Page.User.Identity

我认为,来自那里的人必须使用共享点服务器。 哪些工作取决于你想要列入守则的情况,你们应当把一个破碎点放在你所需要的位置上,并在看望窗看到上面的建筑。 如果有人从那里工作,你就会收到一个标的<编码>System. Security. Principal.Windows Principal/,使你能满足你们的所有需要。 例如,名称财产是用户名称。 团体财产是安全证明人名单,与用户所属群体相对应。 我们可以使用NTAccount类别将安全识别器改为名称。 (例如,见 我有一个用户账户的SID,我想到属于的集团的SIDs。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...