473,766 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1858

"Dooza" <st*****@SPAM.d ooza.tvwrote in message
news:ef******** ******@TK2MSFTN GP06.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 "CloseHandl e"
(ByVal hObject As Long) As Long

Public Const LOGON32_LOGON_N ETWORK = 3
Public Const LOGON32_PROVIDE R_DEFAULT = 0
Function ValidateCredent ials( _
UserName As String, _
Password As String, _
Domain As String _
) As Boolean
Dim hToken As Long

If (LogonUser(User Name, Domain, Password, n, n, hToken) <0) Then
CloseHandle hToken
ValidateCredent ials = 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
4028
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 replication (under "Security Considerations" and elsewhere). This makes sense; however, I was wondering if there were any repercussions to using duplicate local accounts to establish replication where a domain was not available. Anotherwords, create a...
2
2895
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 account or 2) multiple domain service accounts. In this case, all the SQL servers are SQL2000 running on Win2003. The service account is assigned only to the "Domain Users" group.
2
11072
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 in Enterprise Manager and added my user account as a Windows User. If I set Analyzer to use Windows authentication I am to log in with no problems. But if it is set to SQL Server authentication and I type in my username (in the format...
2
1232
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
8314
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 having problems with authentication. I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain...
5
6030
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 my domain account. The server app is running as admin on an XPSP2 box. If I set authentication to Anonymous or Basic, I can get requests. If I change to IntegratedWindowsAuthentication, however, IE on the client prompts me for credentials. I can...
4
41078
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 Query Analyzer that the user ID and password are good and can access the correct tables. However, I am unable to get a connection to the database. I either get a Login Failed for (NULL) user. or Not a Trusted Connection, or Login failed for...
0
1265
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 ie; MachineName\ASPNET is what I use in my VS2005 environment and this works great connecting locally to my local SQL Server DB, since it is one of the accounts that I have locally as a user in SQL Server. The problem is when I try to connect to...
0
1413
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 installed on my machine (winxp), the virtual machine runs IIS under winxp (i am admin on this virtual m/c). The development machine has vs 2005 and is on a domain, the virtual machine is not on the domain. When i am logged into the dev machine with the...
5
13210
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 Properties collection I can't get the properties on some users. For example, I get all the users that are part of my machines Administrators Group. I get get the properties of the built in local Administrator account and some local IT account,...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10008
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.