ASP.NET获取数据AD有关用户数据、用户、ASP、NET

2023-09-08 13:13:11 作者:男生气质

需要识别用户的内部网站,Windows用户名是我们的目标。这将被追加到PARAMS将SQL Server中的终点。

Need to identify user on intranet site, windows user name is the goal. That will be appended to params going to SQL Server in the end.

我能获得 HttpContext.Current.Request.ServerVariables(LOCAL_ADDR)192.168.112.81

我们有一个鱼龙混杂的地址在这里,在这33%是固定的,其余的分配。

We have a mixed bag of addresses here, in that 33% are fixed and the rest are allocated.

有没有追索权,以确定在AD分配到一个IP地址的用户?如果这样做,你有一个链接或一个例子?

Is there a recourse to identify the user assigned to an IP within AD? If so do you have a link or an example?

TIA。

推荐答案

在一个页面上,用户名可以与发现:

Within a page, the username can be found with:

Page.User.Identity.Name

HttpContext.Current.User.Identity.Name

或服务呼叫

ServiceSecurityContext.Current.WindowsIdentity.Name

这将是由域pfixed $ P $。

It will be prefixed by the domain.