473,831 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I validate user credentials

I'm writing a C# program that needs to validate an Active Directory
username/password? The program will be running on a workstation that is not
part of the domain. It doesn't have to do anything else other than determine
if the credentials are valid. Any pointers would be appreciated.
Jul 21 '05 #1
4 7742
On Tue, 2 Mar 2004 18:33:53 -0400, "Paul Steele" <pa*********@ac adiau.ca> wrote:

¤ I'm writing a C# program that needs to validate an Active Directory
¤ username/password? The program will be running on a workstation that is not
¤ part of the domain. It doesn't have to do anything else other than determine
¤ if the credentials are valid. Any pointers would be appreciated.
¤

I don't see how this is possible unless the workstation can talk to the domain either directly or
indirectly. One indirect method might be to contact a web service or remote object that is in the
domain through which you are attempting to authenticate.
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Jul 21 '05 #2
"Paul Clement" <Us************ ***********@sws pectrum.com> wrote in message
news:7s******** *************** *********@4ax.c om...
On Tue, 2 Mar 2004 18:33:53 -0400, "Paul Steele" <pa*********@ac adiau.ca> wrote:
¤ I'm writing a C# program that needs to validate an Active Directory
¤ username/password? The program will be running on a workstation that is not ¤ part of the domain. It doesn't have to do anything else other than determine ¤ if the credentials are valid. Any pointers would be appreciated.
¤

I don't see how this is possible unless the workstation can talk to the domain either directly or indirectly. One indirect method might be to contact a web service or remote object that is in the domain through which you are attempting to authenticate.


The workstation does have access to the domain (such as the domain
controller) so that should not be an issue (I hope). I've just haven't
figured out how to do within my C# program. I've found lots of examples that
I thought would work but no luck so far. There's got to be a way to validate
credentials in this sort of situation.
Jul 21 '05 #3
I solved my own problem. Here's the sample code:

try
{
IADsOpenDSObjec t user = (IADsOpenDSObje ct)Utils.GetObj ect("WinNT:");
user.OpenDSObje ct("WinNT://ad.acadiau.ca", username,passwo rd1,
(int)ADS_AUTHEN TICATION_ENUM.A DS_SECURE_AUTHE NTICATION);
return true;
}
catch
{
return false;
}

"Paul Steele" <pa*********@ac adiau.ca> wrote in message
news:c2******** ***@poseidon.ac adiau.ca...
"Paul Clement" <Us************ ***********@sws pectrum.com> wrote in message
news:7s******** *************** *********@4ax.c om...
On Tue, 2 Mar 2004 18:33:53 -0400, "Paul Steele"
<pa*********@ac adiau.ca> wrote:

¤ I'm writing a C# program that needs to validate an Active Directory
¤ username/password? The program will be running on a workstation that
is not
¤ part of the domain. It doesn't have to do anything else other than determine
¤ if the credentials are valid. Any pointers would be appreciated.
¤

I don't see how this is possible unless the workstation can talk to the

domain either directly or
indirectly. One indirect method might be to contact a web service or

remote object that is in the
domain through which you are attempting to authenticate.


The workstation does have access to the domain (such as the domain
controller) so that should not be an issue (I hope). I've just haven't
figured out how to do within my C# program. I've found lots of examples

that I thought would work but no luck so far. There's got to be a way to validate credentials in this sort of situation.

Jul 21 '05 #4
On Wed, 3 Mar 2004 13:33:53 -0400, "Paul Steele" <pa*********@ac adiau.ca> wrote:

¤ I solved my own problem. Here's the sample code:
¤
¤ try
¤ {
¤ IADsOpenDSObjec t user = (IADsOpenDSObje ct)Utils.GetObj ect("WinNT:");
¤ user.OpenDSObje ct("WinNT://ad.acadiau.ca", username,passwo rd1,
¤ (int)ADS_AUTHEN TICATION_ENUM.A DS_SECURE_AUTHE NTICATION);
¤ return true;
¤ }
¤ catch
¤ {
¤ return false;
¤ }
¤

Looks like you're using the COM based ADSI implementation. You can also use the .NET
System.Director yServices library:

http://msdn.microsoft.com/library/de...etadsearch.asp
(Authenticating to Your Directory)
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Jul 21 '05 #5

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

Similar topics

2
1519
by: Brian Madden | last post by:
Hello Everyone, This is sort of a followup to the protecting files question I asked earlier today. I would like to protect a file so that only certain users could download it from my website. It would be very easy for me to simply use IIS Admin to remove anonymous access to that file and to create a new account on the web server and give those account credentials to my users. That would prohibit people from directly accessing the file...
2
7600
by: Steffen Balslev | last post by:
I tried to find a way to validate user credentials using C#, searching google and lots of other news and kb sites left me without a solution. You can use a SSPI but it's that easy to implement so I found a simple way and here it is: using System.DirectoryServices; public bool Win2kCredentialsIsValid(string domain, string username, string password) { bool validLogin = false; string adPath = "LDAP://" + domain + "/rootDSE";
8
2751
by: Pete Wittig | last post by:
Hello, I am wondering if it is possible to create a networked application with C# that is seen as a windows user. For example, if Bob logged onto windows and then started the application, any access to the network made through the application would be seen as 'C# application user' and not 'Bob'. What I want to accomplish is to create an encrypted folder on a server where files within the folder can be accessed through the application,...
3
2576
by: Jørn A. | last post by:
I'm working on a web based user interface for a job scheduling system (running scripts). The system is using a non-windows scheduler software, but it's installed and running as a windows service. The service is running with the credentials of a specified domain user, and all processes kicked off by the scheduler service runs with these credentials. In the web based interface I want to add a "Run" button for each job, making it...
2
386
by: Paul Steele | last post by:
I'm writing a C# program that needs to validate an Active Directory username/password? The program will be running on a workstation that is not part of the domain. It doesn't have to do anything else other than determine if the credentials are valid. Any pointers would be appreciated.
0
1804
by: exits funnel | last post by:
Hello, I apologize if this question is a bit vague and slightly off topic but I couldn't find an Analysis Services and/or ODBO specific newsgroup. In any event, I'm trying to address an issue in some code I've inherited from a colleague who is on vacation and unfortunately, it deals with ODBO, COM and Analysis Services, three topics with which I'm pretty unfamiliar. Having said that here is the situation as best I can explain it: the...
3
10928
by: Dmitry | last post by:
I am trying to figure out how to pass set of credentials to System.IO Challenge is: App is running under one set of credentials, but via GUI user have a chance to enter another set. I would like to be able to use supplied credentials with System.IO versus using default credentials that app is running under. So far I am forced to use WMI which is less convenient and slower then System.IO, but it's providing me with "Connection Options"
18
23796
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample code/examples? Thanks in advance, Arthur
9
6285
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who only has read access to the users table so that users can log in. Once a user has been logged in successfully I want to escalate that user's access level to one appropriate to their role, which will include switching the postgres user they are...
0
9793
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
10777
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10494
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
10534
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
10207
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9317
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
7748
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
6951
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
5780
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.