Changing Windows password by .NET code?

J

Jens Weiermann

Hi!

I'm using Windows authentication in one of my ASP.NET projects because this
way it's easy for me to define which users has access to which page (using
the NTFS file system security settings).
Now my users want to change their passwords via a web interface. Does
anyone know if it is at all possible to change the windows passwords by
..NET code? Or do I have to change the project to forms authentication and
store user info in a database?

Thanks!
Jens
 
J

Joe Kaplan \(MVP - ADSI\)

J

Jens Weiermann

Hi Joe,
You can use System.DirectoryServices to change the user's password by
invoking the ChangePassword method. There are some docs here:

http://msdn.microsoft.com/library/d...ds/sds/managing_user_passwords.asp?frame=true
http://msdn.microsoft.com/library/d...tication_problems_on_asp_pages.asp?frame=true

the webserver I'm using is not part of a domain, so I don't have an active
directory, only the local users list of that server. I guess the
Sytem.DirectoryServices classes won't work with the local users?!

Other suggestions?

Thanks!
Jens
 
J

Joe Kaplan \(MVP - ADSI\)

It can, but local machine and NT4 domains must use the WinNT provider
instead of the LDAP provider. I'm not an expert in the WinNT provider, but
you should be able to get similar code to work.

Joe K.
 
J

Jens Weiermann

Hi Joe,
It can, but local machine and NT4 domains must use the WinNT provider
instead of the LDAP provider. I'm not an expert in the WinNT provider, but
you should be able to get similar code to work.

uh, sorry - what's a "provider" in this context?

Regards,
Jens
 
J

Joe Kaplan \(MVP - ADSI\)

Ah, in ADSI and S.DS, provider is indicated by the protocol on the "URL" you
use:
LDAP = LDAP provider
WinNT = WinNT provider
IIS = IIS provider

Thus new DirectoryEntry("LDAP://RootDSE"); loads the LDAP provider in the
ADSI system.

There is a lot more documentation on this stuff in the ADSI reference than
in the S.DS reference. There they assume that you generally want to talk to
Active Directory and thus use LDAP.

Joe K.
 

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

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,352
Latest member
DianeKulik

Latest Threads

Top