Solved

validate NT Logon name using ASP and XP

Posted on 2004-04-16
5
408 Views
Last Modified: 2012-06-27
I am using XP and have created an ASP Login page on my site.  At present the user has to type in a user name and password to access the site.

What I would like to do is automatically check the users NT logon name when the page opens.  If the user exists(ie, they are an NT user and they have a relevant row in the associated lookup table within my database), then allow them access.

I have searched various other sites including this one and cannot find the answer.

Any help appreciated
0
Comment
Question by:fx124
5 Comments
 
LVL 7

Expert Comment

by:ramesh12
ID: 10843505
0
 

Author Comment

by:fx124
ID: 10843800
thanks for that ramesh12.

Unfortunately it is not quite what I am looking for.  Maybe my description wasn't clear enough.  I know I can hard-code in the Userdomain and username but that is what I am trying to get away from.  I want the "Application" to pick these up automatically from the machine i am logged in to

Thanks
0
 
LVL 7

Expert Comment

by:TheKenman
ID: 10843973
For the domain, you can use this ADSI example:

     ' Get Domain name from RootDSE object.
     Set objRootDSE = GetObject("LDAP://RootDSE")
     strDomain = objRootDSE.Get("DefaultNamingContext")
     Set objRootDSE = Nothing

For the user, do this:

     strUser = Request.ServerVariables("LOGON_NAME")
     strPW = Request.ServerVariables("AUTH_PASSWORD")

But I think that only works once you've logged in...
0
 

Author Comment

by:fx124
ID: 10844215
Thanks TheKenman

I shall have to get back to you on Monday with the result.  Fingers crossed, eh!
0
 
LVL 5

Accepted Solution

by:
MMeijer earned 500 total points
ID: 10846705
By default the Request.ServerVariables("LOGON_NAME") = empty, unless "allow anonymous access" is off (IIS manager>permissions).

Normally this would result in a authentication box when a user is trying to access the site.
Unless this is about an intranet and users use IE then IE will try to automatically authenticate by sending the current user logon info, for more info on this open IE>Tools>Internet Options>Security.

Once you get the Request.ServerVariables("LOGON_NAME") it exists of domain/username, now you can test the info with ADSI.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now