Click here to Skip to main content
15,929,686 members
Home / Discussions / C#
   

C#

 
GeneralRe: Accessing an object created by another class Pin
NietzscheDisciple6-Oct-04 18:14
NietzscheDisciple6-Oct-04 18:14 
GeneralRe: Accessing an object created by another class Pin
NietzscheDisciple6-Oct-04 18:42
NietzscheDisciple6-Oct-04 18:42 
GeneralRe: Accessing an object created by another class Pin
Tom Clement6-Oct-04 19:07
professionalTom Clement6-Oct-04 19:07 
GeneralControls related question Pin
NietzscheDisciple6-Oct-04 15:08
NietzscheDisciple6-Oct-04 15:08 
GeneralRe: Controls related question Pin
Christian Wikander6-Oct-04 21:12
Christian Wikander6-Oct-04 21:12 
GeneralPasswordAge from LDAP Pin
Andy *M*6-Oct-04 12:11
Andy *M*6-Oct-04 12:11 
GeneralRe: PasswordAge from LDAP Pin
Heath Stewart6-Oct-04 19:44
protectorHeath Stewart6-Oct-04 19:44 
GeneralRe: PasswordAge from LDAP Pin
Andy *M*6-Oct-04 23:38
Andy *M*6-Oct-04 23:38 
Heath Stewart wrote:
"COM object" is not specific. Please tell us what type the debugger reports.

That IS what the debugger reports. To be exact it is a System.__ComObject

If I drop it into the watch window and expand it out it still gives me no new inforomation.

Heath Stewart wrote:
You may have to declare COM interfaces to extract the data

Maybe that is what I need to know. What COM interfaces do I have to declare? I have searched all over the place, MSDN, Google, Google Groups and this seems to be something that is just swept under the carpet. No one either knows or wants to know. There are a few VBScripts out there, but that does not really help me. Or perhaps my search terms are not quite right. I've searched on various combinations of: LDAP DirectoryServices DirectoryEntry PasswordAge Active Directory .NET C#

What I am trying to do is authenticate a user as they log in to my system (as described in How To Use Forms Authentication with Active Directory http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT02.asp[^]) and then warn them if their password is about to expire. Perhaps I am not looking at this from the right angle.

If it helps I wrote a little test app to try some things out. Perhaps I'm doing something wrong here:
static void Main(string[] args)
{
	string thePath = "LDAP://company.co.uk/DC=company,DC=co,DC=uk";
	string domainAndUsername = domain + @"\" + username;
	Console.Write("Enter Password:");
	string password = Console.ReadLine();
	for(int i=0;i<300;i++) 
		Console.WriteLine();
	DirectoryEntry entry = new DirectoryEntry( thePath, 
		domainAndUsername, password);
	Object obj = entry.NativeObject;
	DirectorySearcher search = new DirectorySearcher(entry);
	search.Filter = "(SAMAccountName=" + username + ")";
	search.PropertiesToLoad.Add("cn");
	SearchResult result = search.FindOne();
	if(null == result)
	{
		return;
	}
	// Update the new path to the user in the directory
	thePath = result.Path;
	string theFilterAttribute = (string)result.Properties["cn"][0];
	PropertyCollection  coll = entry.Properties;
	Console.Write("Number of properties: {0}", coll.Count);
	foreach (string name in coll.PropertyNames)
	{
		PropertyValueCollection pvc = coll[name];
		object val = pvc.Value;
		if ((name == "minPwdAge") || (name == "maxPwdAge"))
			Debugger.Break();
		Console.WriteLine("{0}: {1}", name, val);
	}
	Console.ReadLine();
}

GeneralRe: PasswordAge from LDAP Pin
Heath Stewart7-Oct-04 7:10
protectorHeath Stewart7-Oct-04 7:10 
Generalcustom property Pin
Grammel6-Oct-04 11:20
Grammel6-Oct-04 11:20 
GeneralRe: custom property Pin
Heath Stewart6-Oct-04 12:33
protectorHeath Stewart6-Oct-04 12:33 
GeneralRe: custom property Pin
leppie7-Oct-04 0:16
leppie7-Oct-04 0:16 
GeneralRe: custom property Pin
Grammel7-Oct-04 0:32
Grammel7-Oct-04 0:32 
GeneralC# Datagrid link column target Pin
perms6-Oct-04 11:15
perms6-Oct-04 11:15 
GeneralRe: C# Datagrid link column target Pin
Heath Stewart6-Oct-04 14:51
protectorHeath Stewart6-Oct-04 14:51 
Questionhow can i arrange data alphabetically? Pin
visiontec6-Oct-04 11:07
visiontec6-Oct-04 11:07 
AnswerRe: how can i arrange data alphabetically? Pin
Heath Stewart6-Oct-04 14:07
protectorHeath Stewart6-Oct-04 14:07 
GeneralSearch for file Pin
Einar Kvandahl6-Oct-04 9:33
Einar Kvandahl6-Oct-04 9:33 
GeneralRe: Search for file Pin
Christian Graus6-Oct-04 9:56
protectorChristian Graus6-Oct-04 9:56 
GeneralRe: Search for file Pin
Einar Kvandahl6-Oct-04 9:59
Einar Kvandahl6-Oct-04 9:59 
GeneralGtk# Window Refresh Problem Pin
jb33716-Oct-04 8:10
jb33716-Oct-04 8:10 
GeneralRe: Gtk# Window Refresh Problem Pin
Heath Stewart6-Oct-04 13:44
protectorHeath Stewart6-Oct-04 13:44 
GeneralChecking If Form Is Loaded Pin
Daniel Negron6-Oct-04 6:14
Daniel Negron6-Oct-04 6:14 
GeneralRe: Checking If Form Is Loaded Pin
Alex Korchemniy6-Oct-04 8:19
Alex Korchemniy6-Oct-04 8:19 
GeneralRe: Checking If Form Is Loaded Pin
Daniel Negron6-Oct-04 8:29
Daniel Negron6-Oct-04 8:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.