Verifying the password

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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
(e-mail address removed)
 
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/2005/June/ADand.NET.asp

HTH

Ollie Riches
 
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");
}
}
 
hello!

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

tks!
Letícia
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top