473,657 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Verifying the password

We are developing a desktop application for a customer (VS 2003). The
customer wants us to retrieve the Windows logon information from Active
Directory, then ask the user to verify his password and then assure that this
password is the same as the one given when doing Windows logon. This must be
done before starting the app.

I wonder: whats the best way to accomplish this?

Thanks!
Nov 17 '05 #1
6 1774
You can call the unmanaged Windows api function "LogonUser" to check user's
credentials. But this function supported by NT SP3 or higher clients.

Regards,

Dincer Uyav
di********@tekn ainternational. net

"Bevo" wrote:
We are developing a desktop application for a customer (VS 2003). The
customer wants us to retrieve the Windows logon information from Active
Directory, then ask the user to verify his password and then assure that this
password is the same as the one given when doing Windows logon. This must be
done before starting the app.

I wonder: whats the best way to accomplish this?

Thanks!

Nov 17 '05 #2
First off question about AD are better answered by the 2 Joe's in the
following newsgroup:

microsoft.publi c.adsi.general

But there are several ways to achieve what you want, you can use unmanaged
code via the win32 api 'LogonUser' or you can use the DirectoryServic es
namespace.

Using the DirectoryServic es namespace you could do something like this:
{
...
DirectoryEntry de = new DirectoryEntry( );

// example LDAP string 'LDAP://CN=Users;DC=myd omain;DC=net'

de.Path = LDAP://CN=Users;DC=DOM AINNAME;DC=DOMA INSUFFIX;
de.Username = @"USERNAME";
de.Password = "PASSWORD";
string nativeGuid = de.NativeGuid;

...
}

When the call to 'de.NativeGuid' is made if the username or password are
invalid an exception will be thrown.

Have a look at this:

http://www.c-sharpcorner.com/Code/20.../ADand.NET.asp

HTH

Ollie Riches


"Bevo" <Be**@discussio ns.microsoft.co m> wrote in message
news:00******** *************** ***********@mic rosoft.com...
We are developing a desktop application for a customer (VS 2003). The
customer wants us to retrieve the Windows logon information from Active
Directory, then ask the user to verify his password and then assure that
this
password is the same as the one given when doing Windows logon. This must
be
done before starting the app.

I wonder: whats the best way to accomplish this?

Thanks!

Nov 17 '05 #3
you can use System.Director yServices;

/// <summary>
/// AuthenticationT ypes specifying the security
/// protocol to use, i.e. Secure, SSL
/// </summary>
private AuthenticationT ypes atAuthentType;
using(Directory Entry deDirEntry = new DirectoryEntry( strDomain,
strUser,
strPass,
atAuthentType))

{
// if user is verified then it will welcome then
try
{
MessageBox.Show ("Welcome");
// TODO: add your specific tasks here
}
catch (Exception exp)
{
MessageBox.Show ("Sorry, unable to verify your information");
}
}

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com
"Dincer Uyav" <Di********@dis cussions.micros oft.com> wrote in message
news:40******** *************** ***********@mic rosoft.com...
You can call the unmanaged Windows api function "LogonUser" to check user's credentials. But this function supported by NT SP3 or higher clients.

Regards,

Dincer Uyav
di********@tekn ainternational. net

"Bevo" wrote:
We are developing a desktop application for a customer (VS 2003). The
customer wants us to retrieve the Windows logon information from Active
Directory, then ask the user to verify his password and then assure that this password is the same as the one given when doing Windows logon. This must be done before starting the app.

I wonder: whats the best way to accomplish this?

Thanks!

Nov 17 '05 #4
hello!

I need to do you exactly the same, but using ASP, does anybody can help me?

tks!
LetÃ*cia
"Ollie Riches" wrote:
First off question about AD are better answered by the 2 Joe's in the
following newsgroup:

microsoft.publi c.adsi.general

But there are several ways to achieve what you want, you can use unmanaged
code via the win32 api 'LogonUser' or you can use the DirectoryServic es
namespace.

Using the DirectoryServic es namespace you could do something like this:
{
...
DirectoryEntry de = new DirectoryEntry( );

// example LDAP string 'LDAP://CN=Users;DC=myd omain;DC=net'

de.Path = LDAP://CN=Users;DC=DOM AINNAME;DC=DOMA INSUFFIX;
de.Username = @"USERNAME";
de.Password = "PASSWORD";
string nativeGuid = de.NativeGuid;

...
}

When the call to 'de.NativeGuid' is made if the username or password are
invalid an exception will be thrown.

Have a look at this:

http://www.c-sharpcorner.com/Code/20.../ADand.NET.asp

HTH

Ollie Riches


"Bevo" <Be**@discussio ns.microsoft.co m> wrote in message
news:00******** *************** ***********@mic rosoft.com...
We are developing a desktop application for a customer (VS 2003). The
customer wants us to retrieve the Windows logon information from Active
Directory, then ask the user to verify his password and then assure that
this
password is the same as the one given when doing Windows logon. This must
be
done before starting the app.

I wonder: whats the best way to accomplish this?

Thanks!


Nov 17 '05 #5
what you could do is create a .Net aasembly that does all your
authentication to AD in C# and then call this from classic ASP. To do this
you have to get .NET to generate a TLB library for your the .NET class. In
Vs.NET, you can modify the current build profile and set the "Register for
COM Interop" property to true.

http://www.csharphelp.com/archives/archive190.html
http://support.microsoft.com/?kbid=302901

HTH

Ollie Riches

"Leticia Chinen" <Leticia Ch****@discussi ons.microsoft.c om> wrote in message
news:87******** *************** ***********@mic rosoft.com...
hello!

I need to do you exactly the same, but using ASP, does anybody can help
me?

tks!
Letícia
"Ollie Riches" wrote:
First off question about AD are better answered by the 2 Joe's in the
following newsgroup:

microsoft.publi c.adsi.general

But there are several ways to achieve what you want, you can use
unmanaged
code via the win32 api 'LogonUser' or you can use the DirectoryServic es
namespace.

Using the DirectoryServic es namespace you could do something like this:
{
...
DirectoryEntry de = new DirectoryEntry( );

// example LDAP string 'LDAP://CN=Users;DC=myd omain;DC=net'

de.Path = LDAP://CN=Users;DC=DOM AINNAME;DC=DOMA INSUFFIX;
de.Username = @"USERNAME";
de.Password = "PASSWORD";
string nativeGuid = de.NativeGuid;

...
}

When the call to 'de.NativeGuid' is made if the username or password are
invalid an exception will be thrown.

Have a look at this:

http://www.c-sharpcorner.com/Code/20.../ADand.NET.asp

HTH

Ollie Riches


"Bevo" <Be**@discussio ns.microsoft.co m> wrote in message
news:00******** *************** ***********@mic rosoft.com...
> We are developing a desktop application for a customer (VS 2003). The
> customer wants us to retrieve the Windows logon information from Active
> Directory, then ask the user to verify his password and then assure
> that
> this
> password is the same as the one given when doing Windows logon. This
> must
> be
> done before starting the app.
>
> I wonder: whats the best way to accomplish this?
>
> Thanks!


Nov 17 '05 #6
There isn't a license requirement for .Net as such (i.e. it is shipped with
the current windows OS's), you only need a license for Visual Studio .Net
which is the development tool form MS. You can of course use a free
development tool for .Net.

HTH

Ollie Riches

"Leticia Chinen" <Le***********@ discussions.mic rosoft.com> wrote in message
news:1E******** *************** ***********@mic rosoft.com...
hi Ollie!!!

I can´t use your solution because here in the company we don´t have .NET
license. But I found an ASP solution.

If it is interesting for someone, there is a link with an example:
http://www.4guysfromrolla.com/webtech/061202-1.shtml

bye
Leticia

"Ollie Riches" wrote:
what you could do is create a .Net aasembly that does all your
authentication to AD in C# and then call this from classic ASP. To do
this
you have to get .NET to generate a TLB library for your the .NET class.
In
Vs.NET, you can modify the current build profile and set the "Register
for
COM Interop" property to true.

http://www.csharphelp.com/archives/archive190.html
http://support.microsoft.com/?kbid=302901

HTH

Ollie Riches

"Leticia Chinen" <Leticia Ch****@discussi ons.microsoft.c om> wrote in
message
news:87******** *************** ***********@mic rosoft.com...
> hello!
>
> I need to do you exactly the same, but using ASP, does anybody can help
> me?
>
> tks!
> Letícia
>
>
> "Ollie Riches" wrote:
>
>> First off question about AD are better answered by the 2 Joe's in the
>> following newsgroup:
>>
>> microsoft.publi c.adsi.general
>>
>> But there are several ways to achieve what you want, you can use
>> unmanaged
>> code via the win32 api 'LogonUser' or you can use the
>> DirectoryServic es
>> namespace.
>>
>> Using the DirectoryServic es namespace you could do something like
>> this:
>> {
>> ...
>> DirectoryEntry de = new DirectoryEntry( );
>>
>> // example LDAP string 'LDAP://CN=Users;DC=myd omain;DC=net'
>>
>> de.Path = LDAP://CN=Users;DC=DOM AINNAME;DC=DOMA INSUFFIX;
>> de.Username = @"USERNAME";
>> de.Password = "PASSWORD";
>> string nativeGuid = de.NativeGuid;
>>
>> ...
>> }
>>
>> When the call to 'de.NativeGuid' is made if the username or password
>> are
>> invalid an exception will be thrown.
>>
>> Have a look at this:
>>
>> http://www.c-sharpcorner.com/Code/20.../ADand.NET.asp
>>
>> HTH
>>
>> Ollie Riches
>>
>>
>>
>>
>> "Bevo" <Be**@discussio ns.microsoft.co m> wrote in message
>> news:00******** *************** ***********@mic rosoft.com...
>> > We are developing a desktop application for a customer (VS 2003).
>> > The
>> > customer wants us to retrieve the Windows logon information from
>> > Active
>> > Directory, then ask the user to verify his password and then assure
>> > that
>> > this
>> > password is the same as the one given when doing Windows logon. This
>> > must
>> > be
>> > done before starting the app.
>> >
>> > I wonder: whats the best way to accomplish this?
>> >
>> > Thanks!
>>
>>
>>


Nov 17 '05 #7

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

Similar topics

1
1561
by: | last post by:
What is a good resource for integrating ASP applications with Active Directory? I want pages that will allow operations on AD. A prime example is that I want to have an ASP page that would ask users for their AD password and verify... Thanks In Advance!
4
2733
by: Michael | last post by:
I'd like to write a program to verify the consistency between various database replicas in our environment. The rules are as follows: - I'm given two servers, each with a database - I don't know the schema of the database - The databases are large (some tables with 10,000,000+ rows) What would be the best way to perform a pretty-good-guess analysis of whether or not these two databases were in sync?
4
1565
by: HD | last post by:
Hi, I was wondering if there is a way of verifying information that is in the registry of the user's computer??? Or is there a way of checking if a file is on the c:\ of the user's computer?? I want to make a certain verification of who is entering my website... but the IP address is never the same (since it is randomly given to the user) and I can't use the LOGON_USER variable because the users are not all in the same domain. And...
9
2097
by: Carter Smith | last post by:
http://www.icarusindie.com/wiki/index.php/Server-Side_Javascript_Check Sample source included This method requires that your pages are PHP enabled and you have mySQL. Although I suppose you could also use PHP sessions (not cookies as they're client editable). You could actually use any server side scripting language such as Perl or ASP and any database like MS SQL Server. I prefer PHP and MySQL.
6
2375
by: prasi | last post by:
I want to verify the password of a user by accepting the password and comparing with the entry in the /etc/shadow file .But I a, getting an error The following code is giving one error /home/training/prasanna/unix system programming/testpas.c:19: undefined reference to `crypt' collect2: ld returned 1 exit status the code as foolows #include <stdio.h>
1
1359
by: Mike Russelo | last post by:
How can I verify a user-id has a domain account given only the user-id (if I don't have the password)?
5
4009
by: Geisler, Jim | last post by:
So, as far as I know, PostgreSQL does not have any way of verifying the loss of referential integrity. Are there any recommended methods or utilities for checking referential integrity in a PostgreSQL database?
3
2694
by: Thomas Hallgren | last post by:
I'm connected to a database and I want to verify that a username and password for some user is correct. I know I can verify a users existence by doing: select exists(select * from pg_user where usename = $1) but I would like to verify the correctness of the password as well. Is there a way to do that using SQL? Regards,
2
1837
by: chiefsitebuilder | last post by:
I have a question about saving an MS Access program to CD and verifyng that the program works after being saved. Here is my situation, I have a person who developed an application for me using MS Access 2003 and the person will be transferring ownership to me. The developer will be giving me a CD with Access DBase source code on it. How do I verify that he gives me everthing I need to run the application once the developer departs. ...
0
8312
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
8732
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...
0
8606
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
7337
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...
0
5632
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
4159
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
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.