Capturing the Windows 2003 login user name in ASP.NET

P

Paul Ponzelli

I'm using the VB.NET language in ASP.NET, with Windows XP on the desktops
and Windows 2003 on the network servers. When users log on, they have to
enter a user name and password in the netowrk operating system. Is there a
function or other means I can use to capture the Windows 2003 login user
name for use in my code?

Thanks in advance,

Paul
 
R

//Rutger Smit

Hi Paul,

First, in the IIS snap-in, go to the Directory Security tab.
There, click the first edit button (Auth. and access control). Disable
Anonymous Access and be sure to check the Integrated Windows
Authentication checkbox.

Now you can readout the username with Request.ServerVariables("LOGON_USER")

There will be another way wit the System.Security but I have to find
that out how to exactly.


Cheers,
//Rutger

http://www.RutgerSmit.com
 
G

Guest

Actually, dotnet can also get logon user data using Iprincipal object
(Page.User):
string logonUser = Page.User.Identity.Name;

Of course, you should deny anonymous access. And you can deny anonymous
access in application level in web.config file:

<authorization>
<deny user="?" /> <!— deny anonymous -->
<allow roles="*" /> <!—allow all other -->
</authorization>

HTH

Elton Wang
 
P

Paul Ponzelli

Thanks for this way of getting the logon user name, Elton.

And thanks for the info about denying anonymous access.

Paul
 
Joined
Jun 7, 2006
Messages
2
Reaction score
0
How to get client Domain\User?

Thus we can get server domain, but the question is:
How to get client Domain\User?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top