捕获用户名 [英] capturing username

查看:54
本文介绍了捕获用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试捕获Windows Authenticated用户名,但我希望能够捕获IIS中存在的登录名,而不是Windows。为了通过互联网进入我公司的内部网,他们必须登录。我希望

能够捕获该登录与他们的Windows登录,因为我需要

来了解他们来自任何计算机而不仅仅是他们的计算机。任何

想法?


谢谢


解决方案

布伦特,


如果你检查HttpContext.Current.User.Identity,它将是通过Web认证的用户的身份

应用。这是你需要什么?


Jim Cheshire,MCSE,MCSD [MSFT]

Microsoft开发人员支持

ASP.NET
ja******@online.microsoft.com


此帖子按原样提供,不提供任何保证,也不授予任何权利。

--------------- -----

From:" Brent Burkart" < Br *********** @ wvmb.com>
主题:捕获用户名
日期:2003年12月31日星期三11:54:33 -0700
行:12
X-Priority:3
X-MSMail-Priority:正常
X-Newsreader:Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE:由Microsoft MimeOLE V6制作。 00.2800.1165
消息ID:< e#************** @ TK2MSFTNGP10.phx.gbl>
新闻组:microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host:te-64-146-67-30.transedge.com 64.146.67.30
路径:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05 .phx.gbl!TK2MSFTNGP08

..phx.gbl!TK2MSFTNGP10.phx.gblXref:cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:199155
X-Tomcat- NG:microsoft.public.dotnet.framework.aspnet

我试图捕获Windows Authenticated用户名,但我希望能够捕获IIS中存在的登录名,而不是视窗。为了通过互联网进入我公司的内部网,他们必须登录。我想b $ b能够捕获该登录与他们的Windows登录,因为我需要知道他们来自任何计算机而不是他们的计算机。
Anyideas?

谢谢




Brent Burkart写道:

我正在尝试捕获Windows Authenticated用户名,但我希望
能够捕获IIS中存在的登录名,而不是Windows.
为了进入我的公司通过互联网的内联网,他们必须登录。我希望能够捕获该登录与他们的Windows登录,因为我需要知道他们来自任何计算机,而不仅仅是他们的计算机。任何想法?




布伦特,

我会使用System.Security.Principal.WindowsIdentity.GetCurre nt()。名称


在使用HttpContext.Current.User.Identity.Name时要小心。根据IIS / web.config文件设置中的
,User.Identity.Name不会为您提供

正确的结果(对于Windows身份验证模式)。


例如

在我以管理员身份登录的Windows Server 2003文件夹中:


- 使用Identity Impersonate = false和IIS启用匿名访问/启用NTLM

=> WindowsIdentity.GetCurrent()。Name =" NT AUTHORITY \ NETWORK SERVICE"

=> User.Identity.Name =""


- 使用Identity Impersonate = false并禁用IIS匿名访问/启用NTLM

=> WindowsIdentity.GetCurrent()。Name =" NT AUTHORITY \ NETWORK SERVICE"

=> User.Identity.Name =" CARL20 \Administrator"

- 使用Identity Impersonate = true并启用IIS匿名访问/启用NTLM

=> WindowsIdentity.GetCurrent()。Name =" CARL20 \IUSR_CARL20"

=> User.Identity.Name =""


- 使用Identity Impersonate = true并禁用IIS匿名访问/启用NTLM

=> WindowsIdentity.GetCurrent()。Name =" CARL20 \Administrator"

=> User.Identity.Name =" CARL20 \Administrator"


-


谢谢,

Carl Prothman

Microsoft ASP.NET MVP


谢谢Carl,


我有Identity Impersonate = True和IIS匿名访问启用,我是

不确定NTLM是什么。


我仍​​然得到机器登录的用户名而不是内联网

登录。


任何想法?


" Carl Prothman [MVP]" < CA **** @ spamcop.net>在消息中写道

news:uI ************** @ TK2MSFTNGP11.phx.gbl ...

Brent Burkart写道:< blockquote class =post_quotes>我试图捕获Windows Authenticated用户名,但我希望
能够捕获IIS中存在的登录名,而不是Windows.
为了进入我的公司通过互联网的内联网,他们必须登录。我希望能够捕获该登录与他们的Windows登录,因为我需要知道他们来自任何计算机,而不仅仅是他们的计算机。任何想法?

布伦特,
我会使用System.Security.Principal.WindowsIdentity.GetCurre nt()。名称

在使用HttpContext.Current时要小心。 User.Identity.Name。根据IIS / web.config文件设置,User.Identity.Name不会给出正确的结果



(对于Windows身份验证模式)。

例如
在我以管理员身份登录的Windows Server 2003框中:

- 使用Identity Impersonate = false并启用IIS匿名访问/ NTLM
enabled => WindowsIdentity.GetCurrent()。Name =" NT AUTHORITY \ NETWORK SERVICE"
=> User.Identity.Name =""

- 使用Identity Impersonate = false并禁用IIS匿名访问/
启用NTLM => WindowsIdentity.GetCurrent()。Name =" NT AUTHORITY \ NETWORK SERVICE"
=> User.Identity.Name =" CARL20 \Administrator"

- 使用Identity Impersonate = true并启用IIS匿名访问/ NTLM
enabled => WindowsIdentity.GetCurrent()。Name =" CARL20 \IUSR_CARL20"
=> User.Identity.Name =""

- 使用Identity Impersonate = true且禁用IIS匿名访问/ NTLM
enabled => WindowsIdentity.GetCurrent()。Name =" CARL20 \Administrator"
=> User.Identity.Name =" CARL20 \Administrator"


谢谢,
Carl Prothman
Microsoft ASP.NET MVP



I am trying to capture the Windows Authenticated username, but I want to be
able to capture the login name that exists in IIS, not Windows. In order to
enter my company''s intranet through the internet, they have to login. I want
to be able to capture that login versus their Windows login because I need
to know who they are from any computer rather than only their computer. Any
ideas?

Thanks


解决方案

Brent,

If you check HttpContext.Current.User.Identity, it will be the identity of
the user who is authenticated to the Web application. Is that what you
need?

Jim Cheshire, MCSE, MCSD [MSFT]
Microsoft Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------

From: "Brent Burkart" <Br***********@wvmb.com>
Subject: capturing username
Date: Wed, 31 Dec 2003 11:54:33 -0700
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <e#**************@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: te-64-146-67-30.transedge.com 64.146.67.30
Path: cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP10.phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:199155
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

I am trying to capture the Windows Authenticated username, but I want to be
able to capture the login name that exists in IIS, not Windows. In order to
enter my company''s intranet through the internet, they have to login. I wantto be able to capture that login versus their Windows login because I need
to know who they are from any computer rather than only their computer. Anyideas?

Thanks




Brent Burkart wrote:

I am trying to capture the Windows Authenticated username, but I want
to be able to capture the login name that exists in IIS, not Windows.
In order to enter my company''s intranet through the internet, they
have to login. I want to be able to capture that login versus their
Windows login because I need to know who they are from any computer
rather than only their computer. Any ideas?



Brent,
I would use System.Security.Principal.WindowsIdentity.GetCurre nt().Name

Watch out when using HttpContext.Current.User.Identity.Name. Depending
on the IIS / web.config file settings, User.Identity.Name will not give you the
correct result (for Windows authentication mode).

e.g.
On a Windows Server 2003 box where I''m logged in as Administrator:

- With Identity Impersonate= false and IIS Anonymous Access enabled / NTLM enabled
=> WindowsIdentity.GetCurrent().Name = "NT AUTHORITY\NETWORK SERVICE"
=> User.Identity.Name = ""

- With Identity Impersonate= false and IIS Anonymous Access disabled / NTLM enabled
=> WindowsIdentity.GetCurrent().Name = "NT AUTHORITY\NETWORK SERVICE"
=> User.Identity.Name = "CARL20\Administrator"
- With Identity Impersonate= true and IIS Anonymous Access enabled / NTLM enabled
=> WindowsIdentity.GetCurrent().Name = "CARL20\IUSR_CARL20"
=> User.Identity.Name = ""

- With Identity Impersonate= true and IIS Anonymous Access disabled / NTLM enabled
=> WindowsIdentity.GetCurrent().Name = "CARL20\Administrator"
=> User.Identity.Name = "CARL20\Administrator"

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP


Thanks Carl,

I have Identity Impersonate = True and IIS Anonymous Access enabled and I am
not sure what NTLM is.

I still get the username of the machine login rather than the intranet
login.

Any ideas?

"Carl Prothman [MVP]" <ca****@spamcop.net> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...

Brent Burkart wrote:

I am trying to capture the Windows Authenticated username, but I want
to be able to capture the login name that exists in IIS, not Windows.
In order to enter my company''s intranet through the internet, they
have to login. I want to be able to capture that login versus their
Windows login because I need to know who they are from any computer
rather than only their computer. Any ideas?

Brent,
I would use System.Security.Principal.WindowsIdentity.GetCurre nt().Name

Watch out when using HttpContext.Current.User.Identity.Name. Depending
on the IIS / web.config file settings, User.Identity.Name will not give


you the correct result (for Windows authentication mode).

e.g.
On a Windows Server 2003 box where I''m logged in as Administrator:

- With Identity Impersonate= false and IIS Anonymous Access enabled / NTLM enabled => WindowsIdentity.GetCurrent().Name = "NT AUTHORITY\NETWORK SERVICE"
=> User.Identity.Name = ""

- With Identity Impersonate= false and IIS Anonymous Access disabled / NTLM enabled => WindowsIdentity.GetCurrent().Name = "NT AUTHORITY\NETWORK SERVICE"
=> User.Identity.Name = "CARL20\Administrator"
- With Identity Impersonate= true and IIS Anonymous Access enabled / NTLM enabled => WindowsIdentity.GetCurrent().Name = "CARL20\IUSR_CARL20"
=> User.Identity.Name = ""

- With Identity Impersonate= true and IIS Anonymous Access disabled / NTLM enabled => WindowsIdentity.GetCurrent().Name = "CARL20\Administrator"
=> User.Identity.Name = "CARL20\Administrator"

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP



这篇关于捕获用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆