Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Problem with DirectoryServices Access

Reply
Thread Tools

Problem with DirectoryServices Access

 
 
Brian01
Guest
Posts: n/a
 
      03-28-2005

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();
}

 
Reply With Quote
 
 
 
 
Joe Kaplan \(MVP - ADSI\)
Guest
Posts: n/a
 
      03-28-2005
You also need an assembly reference to System.DirectoryServices (use the
assembly page directive or the equivalent stuff in web.config).

Joe K.

"Brian01" <> wrote in message
news:518D5383-E241-4318-BA93-...
>
> 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();
> }
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASPNet 2.0 DirectoryServices problem Jason Huang ASP .Net 1 08-23-2007 09:27 AM
Problem with DirectoryServices 2.0 Brian.ONeil@MCDean.com ASP .Net 0 12-20-2005 09:36 PM
Imports System.DirectoryServices Problem sck10 ASP .Net 2 06-10-2005 01:58 AM
LDAP problem with System.DirectoryServices goldan ASP .Net 1 03-09-2005 10:42 PM
Imports 'System.DirectoryServices' cannot be found. Edward ASP .Net 1 07-08-2003 12:45 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57