Thanks Phil and Brad,
Implementing Server side solution seems to be the best way in terms of
overall design of application too.
Thanks,
Paresh.
-----Original Message-----
From: Phil Griffiths [mailto:pgtips@m...]
Sent: Friday, May 18, 2001 11:08 AM
To: javascript
Subject: [javascript] Re: Current Windows NT user name using javascript
I agree with Brad - you would need something server-side to do this. But
even then you have a problem because generally people access web/intranet
pages using Anonymous access. On NT this means that a specific user is
created (automatically by NT?) for web access only - generally this is
IUSR_machine name, so a user's actual login name is not generally
available.
If you disallow anonymous access in IIS configuration then you will get
the user name (server-side). Do you really want to do this just to
suggest a default value for an input box?
If you do want to do this you have 2 choices of authentication:
1. NT challenge-response, where NT will send the actual user name not
IUSR_... without user having to do anything
2. Basic authentication - where the user will have to enter their (NT)
username and password before they can access the page.
There are various server variables you can use to get the login name. I
know this is a Javascript list but I'll put them here anyway so you don't
have to go elsewhere to ask what they are. In ASP you want
Request.ServerVariables("LOGIN_USER") or .."AUTH_USER" or "REMOTE_USER".
All 3 seem to be filled for challenge/response or basic authentication but
on IIS4 and 5 none of them are filled if you allow anonymous access.
BTW the value is DomainName\UserName.
Hope this helps.
Phil
> > Hello,
> >
> > Is it possible to get current NT user name using javascript?
> > For a memeber only website on a different server, I want to suggest
> > default userID same as the current Windows NT user account
> > (This is an ASP application)
> >
> > Thanks,
> > Paresh.
> >
>
> Paresh,
>
> As per my understanding, JavaScript is incapable of interacting with, or
> obtaining data or information from, anything outside of the browser
> environment (note: a cookie would be part of the browser environment).
> This would mean that the Windows NT user account would be unavailable to
> JavaScript. This is MY understanding, perhaps others will dispute my
> claim, or perhaps they will re-affirm my claim.
>
> Bradley Wilson