Problem with DirectoryServices Access

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Problem with DirectoryServices Access


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

    Brian01 Guest

  2. Similar Questions and Discussions

    1. Impersonation, DirectoryServices
      Do you get an UnauthorizedAccessException from the InnerException from the TargetInvocationException that gets thrown or something else? ...
    2. Sytem.DirectoryServices
      Add an assembly reference to it first. Joe K. "prakash s via .NET 247" <anonymous@dotnet247.com> wrote in message...
    3. System.DirectoryServices
      I have a few pages which authenticate a user to our site. Checking a login and password with syntax as below: Dim entry As New...
    4. DirectoryServices error!
      Hi all, I encounter some problem in DirectoryServices, could someone help me? private void InitLoginUser() { DirectoryEntry objEntry = new...
    5. ASP.NET + DirectoryServices
      Hi all, Could I use DirectoryServices in ASP.NET? Or could you give sample code? Thanks! Best Regards Enosh Chang
  3. #2

    Default Re: Problem with DirectoryServices Access

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

    Joe K.

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

    Joe Kaplan \(MVP - ADSI\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139