473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

NT Domain Account

Hi there,
Using classic ASP I want to check if a username and password are correct
before passing the details on to an object (stocktake module) that uses
them to authenticate the object. The object defaults to a preset user if
the authentication fails and doesn't warn the user, so I wanted to do
the check manually before passing it to the object.

Does anyone have any resources?

Cheers,

Steve
Nov 6 '07 #1
2 1839

"Dooza" <st*****@SPAM.dooza.tvwrote in message
news:ef**************@TK2MSFTNGP06.phx.gbl...
Hi there,
Using classic ASP I want to check if a username and password are correct
before passing the details on to an object (stocktake module) that uses
them to authenticate the object. The object defaults to a preset user if
the authentication fails and doesn't warn the user, so I wanted to do the
check manually before passing it to the object.

Does anyone have any resources?
You will need to create a COM object to do this, it can't be done in script.
On the bright side, the code to accomplish this is fairly trivial, all you
need to do is call the LogonUser API. (Note that if it succeeds you should
close the token handle it returns.)

If you wanted to do it in VB6, it would look something like this:
Public Declare Function LogonUser Lib "kernel32" Alias "LogonUserA" (ByVal
lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As
String, ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As
Long) As Long

Public Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle"
(ByVal hObject As Long) As Long

Public Const LOGON32_LOGON_NETWORK = 3
Public Const LOGON32_PROVIDER_DEFAULT = 0
Function ValidateCredentials( _
UserName As String, _
Password As String, _
Domain As String _
) As Boolean
Dim hToken As Long

If (LogonUser(UserName, Domain, Password, n, n, hToken) <0) Then
CloseHandle hToken
ValidateCredentials = True
End If

End Function

-Mark

Cheers,

Steve

Nov 6 '07 #2
Mark J. McGinty wrote:
You will need to create a COM object to do this, it can't be done in script.
On the bright side, the code to accomplish this is fairly trivial, all you
need to do is call the LogonUser API. (Note that if it succeeds you should
close the token handle it returns.)

If you wanted to do it in VB6, it would look something like this:
Hi Mark,
Thank for the code, I wish I knew how to make a COM object, but will see
if a friend can do something with this for me.

Thank you!

Steve
Nov 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave C. | last post by:
Hi there, BOL notes that in order for replication agents to run properly, the SQLServerAgent must run as a domain account which has privledges to log into the other machines involved in...
2
by: D Barry | last post by:
Greetings: I am trying to conceive what risks might be created by running multiple SQL servers within a domain under a single domain account, as opposed to 1) running under the local service...
2
by: Jason | last post by:
I doing some testing with security and ran into the following problem. I want to log into the SQL server (from Query Analyzer) using my domain account. To allow this, I went into Logins section...
2
by: Ollie | last post by:
Is it possible to run a web service under a domain account as appose the the ASPNET machine account? If so, how do you set this up? Cheers, Ollie
10
by: Martin Robins | last post by:
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am...
5
by: davesmith | last post by:
I have a very simple console app using an HttpListener to listen for incoming HTTP requests (see code below). My client and server machines are both in an ADS domain and I'm logged into both using...
4
by: Tim Sapp | last post by:
Folks, I am working on a .Net web site that connects to SQL Server 2000 on another box. The DBA has given me a Domain user account with rights to the database and table. I have confirmed with...
0
by: Chris Davoli | last post by:
We are changing from using SQL accounts in our connection string to use NT domain accounts. I have found some coe which I am using successfully on my local machine, because the installed account...
0
by: Vivek | last post by:
Because of the increased security concerns of the network admin, i no longer am the admin on my development machine. To work around this and have a secure environment, I have virtual pc 2004 ...
5
by: Michael Howes | last post by:
I'm writing a utility to manage a machines *local* accounts in c# I am getting all the users in a specific Group just fine but when I want to get some of the information on each user from their...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.