Problem with DirectoryServices Access

B

Brian01

I have a Win2K server in a DMZ without domain access. My C# ASP.net page
can not see the DirectoryServices namespace. I found a KB article on the
security issue with this, but I don't have domain accounts to use from the
DMZ, and don't want to set the machine.config properties for all aspx pages.
I just want to set the password from a simple verification application that
passes the user ID and password to the below page. Can this be done another
way? Thanks for any assistance.

<%@ Page Language="C#" Debug="true" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.DirectoryServices" %>

<script runat="server">
private void Page_Load (object sender, EventArgs e){

String empNum = Session["lawEmpNum"].ToString();
String newPassword = Session["password"].ToString();
Response.Write("Employee Number is " + empNum);
Response.Write("Password is " + newPassword);

// correct the userPath!!!
String userPath = "WinNT://localhost/" + empNum;
using (DirectoryEntry userEntry = new DirectoryEntry(userPath))
{
object[] password = new object[] {newPassword};
object ret = userEntry.Invoke("SetPassword", password );
userEntry.CommitChanges();
}
 
J

Joe Kaplan \(MVP - ADSI\)

You also need an assembly reference to System.DirectoryServices (use the
assembly page directive or the equivalent stuff in web.config).

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
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top