473,320 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DirectoryEntry.Properties["userPassword"][0]

Hi

I have problem reading the userPassword - Property from an Entry with
the person-Schema using Microsoft Dotnet. I use DirectoryServices
library and LDAP in my class. The code I used is as following:

DirectoryEntry de = new
DirectoryEntry,gAllgemein.IBMLDAPServerPathBenutze r,"cn=root","ldap",AuthenticationTypes.None);
String ergebnis = aktBenutzer.Properties["userPassword"][0].ToString();

ergebnis return "System.Byte[]"

I can't read the userPassword, because i can't convert the Object into
a byte-Array.

In Visual Studio in the monitoring-Window i can ask
"aktBenutzer.Properties["userPassword"][0][0]" and i get the first
byte and so on, but not in the coding. Can you help me?

Petra
Nov 15 '05 #1
2 8942
Petra,

All you have to do is the following:

// Cast the password to a byte array.
byte[] pbytBytes = (byte[]) aktBenutzer.Properties["userPassword"][0];

Once you have that, that should be all there is to it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Petra" <pe**************@t-systems.com> wrote in message
news:cf**************************@posting.google.c om...
Hi

I have problem reading the userPassword - Property from an Entry with
the person-Schema using Microsoft Dotnet. I use DirectoryServices
library and LDAP in my class. The code I used is as following:

DirectoryEntry de = new
DirectoryEntry,gAllgemein.IBMLDAPServerPathBenutze r,"cn=root","ldap",Authent
icationTypes.None); String ergebnis = aktBenutzer.Properties["userPassword"][0].ToString();

ergebnis return "System.Byte[]"

I can't read the userPassword, because i can't convert the Object into
a byte-Array.

In Visual Studio in the monitoring-Window i can ask
"aktBenutzer.Properties["userPassword"][0][0]" and i get the first
byte and so on, but not in the coding. Can you help me?

Petra

Nov 15 '05 #2
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:<Oo**************@TK2MSFTNGP10.phx.gbl>...
Petra,

All you have to do is the following:

// Cast the password to a byte array.
byte[] pbytBytes = (byte[]) aktBenutzer.Properties["userPassword"][0];

Once you have that, that should be all there is to it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Petra" <pe**************@t-systems.com> wrote in message
news:cf**************************@posting.google.c om...
Hi

I have problem reading the userPassword - Property from an Entry with
the person-Schema using Microsoft Dotnet. I use DirectoryServices
library and LDAP in my class. The code I used is as following:

DirectoryEntry de = new

DirectoryEntry,gAllgemein.IBMLDAPServerPathBenutze r,"cn=root","ldap",Authent
icationTypes.None);
String ergebnis = aktBenutzer.Properties["userPassword"][0].ToString();

ergebnis return "System.Byte[]"

I can't read the userPassword, because i can't convert the Object into
a byte-Array.

In Visual Studio in the monitoring-Window i can ask
"aktBenutzer.Properties["userPassword"][0][0]" and i get the first
byte and so on, but not in the coding. Can you help me?

Petra


Thank you for your tip, but it doesn' work. i get a
System.ArgumentOutOfRangeException. Have you any other idea?

Thank
Petra
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Querton Pierre-Benoit | last post by:
Hello, I develop a class to control IIS throw ADSI. But is seems that some method doesn't work with IIS. To be more clear ;) When I do the following code : DirectoryEntry w3svc = new...
2
by: Jessica | last post by:
When I create a single LDAP ActiveDirectory user and use DirectoryEntry.Invoke("SetPassword"...), the user is created and the password is set with no problems. However, when I try to add more...
0
by: Jessica | last post by:
I have a .Net 1.0 web service that uses a .Net 1.1 assembly to create users, change users' passwords, validate users, and remove users from an LDAP server. The 1.1 code uses the DirectoryServices...
2
by: Jay | last post by:
Please excuse the double post if your reader shows this as a new and as a reply. I can only use the web interface and it puts my reply 34 pages in. I am getting an error while trying to do a...
2
by: AbdSol | last post by:
I wanted to know why the output is different & also like to know if C# i can get the user name using DirectoryEntry > find. C# String myADSPath = ("WinNT://"+...
1
by: kenguil | last post by:
I'm hoping that this is the right group to post this to and that someone will have an answer to this. Environment: 1) Laptop joined to domain "foo.com", logged in using cached credentials 2)...
2
by: Chad Beckner | last post by:
Hi everyone, Sorry for cross posting, but I wanted to try and put this where it would be more visible to everyone... :-) I need to find a way to be able to search for entries in our ADS tree. ...
0
by: Mik | last post by:
Hi I am struggling to make a Web site/Web Directory copy work. I am using the System.DirectoryServices to connect to my localhost machine. There I have two web sites: Mysite1 (siteno 1) and...
6
by: huzz | last post by:
How do i create a directory entry to access a user's details such as their email address. Here are the object structure. domain.co.uk | |Computer Services - Type (OU) | |Cliff Saran - Type...
1
by: Magnus R | last post by:
In VB.Net I'm trying to find out the names of what Administrative Groups exist by querying Active Directory. The problem is when I try and query the children of the key LDAP://CN=Administrative...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.