Click here to Skip to main content
15,884,472 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to serialize an image to a file Pin
AspDotNetDev3-Sep-10 11:47
protectorAspDotNetDev3-Sep-10 11:47 
GeneralRe: How to serialize an image to a file Pin
harold aptroot3-Sep-10 13:02
harold aptroot3-Sep-10 13:02 
QuestionGUI with Console Output C# Pin
I Believe In GOD3-Sep-10 9:21
I Believe In GOD3-Sep-10 9:21 
AnswerRe: GUI with Console Output C# Pin
OriginalGriff3-Sep-10 9:42
mveOriginalGriff3-Sep-10 9:42 
AnswerRe: GUI with Console Output C# Pin
DaveyM693-Sep-10 9:42
professionalDaveyM693-Sep-10 9:42 
GeneralRe: GUI with Console Output C# Pin
I Believe In GOD3-Sep-10 10:05
I Believe In GOD3-Sep-10 10:05 
AnswerRe: GUI with Console Output C# Pin
PIEBALDconsult3-Sep-10 16:57
mvePIEBALDconsult3-Sep-10 16:57 
QuestionLDAP DirectoryEntry and Exceptions. Pin
Mike Doner3-Sep-10 8:20
Mike Doner3-Sep-10 8:20 
I'm doing some work with Active Directory using C# and the DirectoryEntry object. I'm fairly new to C# and exceptions, go easy on me!

Some Code:

DirectoryEntry entry = new DirectoryEntry ( LDAPServer, domainAndUsername, Password );

try
{
    // Bind to the native AdsObject to force authentication.
    Object obj = entry.NativeObject;
}
catch (Exception ex)
{
    ErrorMessage = ex.Message;
    return false;
}


Now, it seems that when binding to the DirectoryEntry fails, the exception is called. The error is returned as a string, which gives me an idea as to what happened, But how do I test what the error was programmatically? Is there some kind of numeric value as well in the exception that I can test?

Basically, I want to know if the connection failed because of a bad ldapserver, or a username/password mismatch etc. I'm trying to create code that does a fail-over to a second ldap server if the primary ldap server is offline. I don't want to jump to the second server to retry the authentication, if there was an error with the credentials.

Is there another exception I can test for here? How would I found out what other exceptions are available for this object?

Any help you could give would be great.. Heck, I'll buy you a beer!

Mike
AnswerRe: LDAP DirectoryEntry and Exceptions. Pin
Henry Minute3-Sep-10 10:04
Henry Minute3-Sep-10 10:04 
QuestionRead Table of Content from PDF using PDFBOX library Pin
Nilesh Araligidad3-Sep-10 3:55
Nilesh Araligidad3-Sep-10 3:55 
AnswerRe: Read Table of Content from PDF using PDFBOX library Pin
Dave Kreskowiak3-Sep-10 4:53
mveDave Kreskowiak3-Sep-10 4:53 
QuestionMouseMove-Event without moving the mouse on Windows 7? Pin
Bernhard Hiller3-Sep-10 3:37
Bernhard Hiller3-Sep-10 3:37 
AnswerRe: MouseMove-Event without moving the mouse on Windows 7? Pin
jtobikidd15-Sep-10 4:46
jtobikidd15-Sep-10 4:46 
AnswerRe: MouseMove-Event without moving the mouse on Windows 7? Pin
Pawel Gielmuda16-Feb-11 22:44
Pawel Gielmuda16-Feb-11 22:44 
QuestionThreaded client server connection problems Pin
teknolog1233-Sep-10 3:07
teknolog1233-Sep-10 3:07 
AnswerRe: Threaded client server connection problems Pin
Ian Shlasko3-Sep-10 3:28
Ian Shlasko3-Sep-10 3:28 
GeneralRe: Threaded client server connection problems Pin
teknolog1234-Sep-10 5:07
teknolog1234-Sep-10 5:07 
GeneralRe: Threaded client server connection problems Pin
Ian Shlasko4-Sep-10 5:30
Ian Shlasko4-Sep-10 5:30 
QuestionCheck if File is in Use Pin
MumbleB3-Sep-10 1:42
MumbleB3-Sep-10 1:42 
AnswerRe: Check if File is in Use Pin
OriginalGriff3-Sep-10 1:59
mveOriginalGriff3-Sep-10 1:59 
AnswerRe: Check if File is in Use Pin
Dave Kreskowiak3-Sep-10 2:17
mveDave Kreskowiak3-Sep-10 2:17 
AnswerRe: Check if File is in Use Pin
Łukasz Nowakowski3-Sep-10 3:13
Łukasz Nowakowski3-Sep-10 3:13 
QuestionHow to access public varialbes in C# class Pin
Joe Rozario3-Sep-10 1:31
Joe Rozario3-Sep-10 1:31 
AnswerRe: How to access public varialbes in C# class Pin
#realJSOP3-Sep-10 1:34
mve#realJSOP3-Sep-10 1:34 
GeneralRe: How to access public varialbes in C# class Pin
Joe Rozario3-Sep-10 1:39
Joe Rozario3-Sep-10 1:39 

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.