DirectoryService - Exceptions

Discussion in 'ASP .Net Security' started by Guest, Jun 20, 2005.

  1. Guest

    Guest Guest

    Hi
    Is there a way to find out what COMException is being thrown as a result of
    an operation, for example

    DirectoryEntry newUser = entry.Children.Add(<newuser_CNname>, "user")

    I suppose this one would throw a COMException if a duplicate CNname is
    found. But if other operations, coming after this one, would also throw
    COMExceptions, then how can I differentiate the COMException thrown by each
    operation as the COMException error message doesn't seems to provide
    specific information. Do I need to throw ApplicationException in this case?
    In order to do that, do I need to define my own class of
    ApplicationException?

    TIA

    --
     
    Guest, Jun 20, 2005
    #1
    1. Advertising

  2. Are you saying you want to know what the COM error was or want more details
    than what it provides you?

    The COMException has an ErrorCode property that you can use to get the exact
    error codes, but they aren't much more helpful than the error messages
    except for handling them programmatically.

    If you want more details about the underlying failure, the only way I know
    is to p/invoke ADsGetLastError. I might have a sample somewhere if I look
    around.

    Throwing an ApplicationException won't help you unless I totally don't
    understand what you want to do.

    Joe K.

    <dl> wrote in message news:...
    > Hi
    > Is there a way to find out what COMException is being thrown as a result
    > of
    > an operation, for example
    >
    > DirectoryEntry newUser = entry.Children.Add(<newuser_CNname>, "user")
    >
    > I suppose this one would throw a COMException if a duplicate CNname is
    > found. But if other operations, coming after this one, would also throw
    > COMExceptions, then how can I differentiate the COMException thrown by
    > each
    > operation as the COMException error message doesn't seems to provide
    > specific information. Do I need to throw ApplicationException in this
    > case?
    > In order to do that, do I need to define my own class of
    > ApplicationException?
    >
    > TIA
    >
    > --
    >
    >
    >
     
    Joe Kaplan \(MVP - ADSI\), Jun 20, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGltOjouLg==?=

    DirectoryService Problem...

    =?Utf-8?B?VGltOjouLg==?=, Feb 8, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,986
    =?Utf-8?B?VGltOjouLg==?=
    Feb 8, 2005
  2. =?Utf-8?B?VGltOjouLg==?=

    VB DirectoryService Guru... HELP???

    =?Utf-8?B?VGltOjouLg==?=, Feb 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    366
    =?Utf-8?B?VGltOjouLg==?=
    Feb 9, 2005
  3. =?Utf-8?B?VGltOjouLg==?=

    HELP... LDAP/ DirectoryService Guru

    =?Utf-8?B?VGltOjouLg==?=, Feb 18, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    334
    =?Utf-8?B?VGltOjouLg==?=
    Feb 18, 2005
  4. =?Utf-8?B?VGltOjouLg==?=

    DirectoryService Query... Help

    =?Utf-8?B?VGltOjouLg==?=, Mar 29, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    1,535
    Scott Allen
    Mar 29, 2005
  5. =?Utf-8?B?VGltOjouLg==?=

    ADSI... DirectoryService... DataGrid

    =?Utf-8?B?VGltOjouLg==?=, Mar 31, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    371
    Patrick Olurotimi Ige
    Mar 31, 2005
Loading...

Share This Page