473,503 Members | 4,692 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 1767
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********@teknainternational.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.public.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 DirectoryServices
namespace.

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

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

de.Path = LDAP://CN=Users;DC=DOMAINNAME;DC=DOMAINSUFFIX;
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**@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.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.DirectoryServices;

/// <summary>
/// AuthenticationTypes specifying the security
/// protocol to use, i.e. Secure, SSL
/// </summary>
private AuthenticationTypes atAuthentType;
using(DirectoryEntry 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********@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.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********@teknainternational.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.public.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 DirectoryServices
namespace.

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

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

de.Path = LDAP://CN=Users;DC=DOMAINNAME;DC=DOMAINSUFFIX;
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**@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.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****@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.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.public.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 DirectoryServices
namespace.

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

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

de.Path = LDAP://CN=Users;DC=DOMAINNAME;DC=DOMAINSUFFIX;
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**@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.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.microsoft.com> wrote in message
news:1E**********************************@microsof t.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****@discussions.microsoft.com> wrote in
message
news:87**********************************@microsof t.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.public.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
>> DirectoryServices
>> namespace.
>>
>> Using the DirectoryServices namespace you could do something like
>> this:
>> {
>> ...
>> DirectoryEntry de = new DirectoryEntry();
>>
>> // example LDAP string 'LDAP://CN=Users;DC=mydomain;DC=net'
>>
>> de.Path = LDAP://CN=Users;DC=DOMAINNAME;DC=DOMAINSUFFIX;
>> 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**@discussions.microsoft.com> wrote in message
>> news:00**********************************@microsof t.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
1551
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...
4
2716
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...
4
1559
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...
9
2086
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...
6
2364
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...
1
1350
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
3991
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...
3
2685
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...
2
1831
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...
0
7093
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...
1
7012
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...
0
7468
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...
0
5598
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,...
1
5023
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...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
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...

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.