Home All Groups Group Topic Archive Search About

Is there a function that I can call to validate a domain?

Author
5 Nov 2006 10:45 PM
Pucca
Hi, I'm using vs2005 and C#.  In my application I am allowing the user to
enter a string representing a domain that they would like the appl to connect
to and build a TreeView control based on AD objects in the domain that they
entered.  Is there a function that I can call to validate the string that the
user entered is a valid domain?

--
Thanks.

Author
6 Nov 2006 12:08 AM
Joe Kaplan
How about the static Domain.GetDomain method in
System.DirectoryServices.ActiveDirectory?  That function takes a
DirectoryContext which could contain alternate credentials, so it would be
up to you to decide whether you want to rely on the current security context
or prompt the user for different creds.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
Show quoteHide quote
"Pucca" <Pu***@discussions.microsoft.com> wrote in message
news:4586630D-B47D-466F-AD8B-0D32690F7BD6@microsoft.com...
> Hi, I'm using vs2005 and C#.  In my application I am allowing the user to
> enter a string representing a domain that they would like the appl to
> connect
> to and build a TreeView control based on AD objects in the domain that
> they
> entered.  Is there a function that I can call to validate the string that
> the
> user entered is a valid domain?
>
> --
> Thanks.
Author
6 Nov 2006 6:58 AM
Pucca
Thanks Joe.  I use that and it does the job but it's kind of slow.  I
remember calling some function in my other C++ program, ext property page,
that verifies the domain for me.  I guess we don't have one like that in .net
but it does the job for now.  Thank you.
--
Thanks.


Show quoteHide quote
"Joe Kaplan" wrote:

> How about the static Domain.GetDomain method in
> System.DirectoryServices.ActiveDirectory?  That function takes a
> DirectoryContext which could contain alternate credentials, so it would be
> up to you to decide whether you want to rely on the current security context
> or prompt the user for different creds.
>
> Joe K.
>
> --
> Joe Kaplan-MS MVP Directory Services Programming
> Co-author of "The .NET Developer's Guide to Directory Services Programming"
> http://www.directoryprogramming.net
> --
> "Pucca" <Pu***@discussions.microsoft.com> wrote in message
> news:4586630D-B47D-466F-AD8B-0D32690F7BD6@microsoft.com...
> > Hi, I'm using vs2005 and C#.  In my application I am allowing the user to
> > enter a string representing a domain that they would like the appl to
> > connect
> > to and build a TreeView control based on AD objects in the domain that
> > they
> > entered.  Is there a function that I can call to validate the string that
> > the
> > user entered is a valid domain?
> >
> > --
> > Thanks.
>
>
>
Author
6 Nov 2006 3:20 PM
Joe Kaplan
That's the only function built in to the framework as of now.  You could
always p/invoke the Win32 function if you wanted to.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
Show quoteHide quote
"Pucca" <Pu***@discussions.microsoft.com> wrote in message
news:DC0C84EE-1EF3-4FB6-B835-7115B687BBD3@microsoft.com...
> Thanks Joe.  I use that and it does the job but it's kind of slow.  I
> remember calling some function in my other C++ program, ext property page,
> that verifies the domain for me.  I guess we don't have one like that in
> .net
> but it does the job for now.  Thank you.
> --
> Thanks.
>
>
> "Joe Kaplan" wrote:
>
>> How about the static Domain.GetDomain method in
>> System.DirectoryServices.ActiveDirectory?  That function takes a
>> DirectoryContext which could contain alternate credentials, so it would
>> be
>> up to you to decide whether you want to rely on the current security
>> context
>> or prompt the user for different creds.
>>
>> Joe K.
>>
>> --
>> Joe Kaplan-MS MVP Directory Services Programming
>> Co-author of "The .NET Developer's Guide to Directory Services
>> Programming"
>> http://www.directoryprogramming.net
>> --
>> "Pucca" <Pu***@discussions.microsoft.com> wrote in message
>> news:4586630D-B47D-466F-AD8B-0D32690F7BD6@microsoft.com...
>> > Hi, I'm using vs2005 and C#.  In my application I am allowing the user
>> > to
>> > enter a string representing a domain that they would like the appl to
>> > connect
>> > to and build a TreeView control based on AD objects in the domain that
>> > they
>> > entered.  Is there a function that I can call to validate the string
>> > that
>> > the
>> > user entered is a valid domain?
>> >
>> > --
>> > Thanks.
>>
>>
>>
Author
6 Nov 2006 6:36 PM
Pucca
Right.  Thank you very much Joe.
--
Thanks.


Show quoteHide quote
"Joe Kaplan" wrote:

> That's the only function built in to the framework as of now.  You could
> always p/invoke the Win32 function if you wanted to.
>
> Joe K.
>
> --
> Joe Kaplan-MS MVP Directory Services Programming
> Co-author of "The .NET Developer's Guide to Directory Services Programming"
> http://www.directoryprogramming.net
> --
> "Pucca" <Pu***@discussions.microsoft.com> wrote in message
> news:DC0C84EE-1EF3-4FB6-B835-7115B687BBD3@microsoft.com...
> > Thanks Joe.  I use that and it does the job but it's kind of slow.  I
> > remember calling some function in my other C++ program, ext property page,
> > that verifies the domain for me.  I guess we don't have one like that in
> > .net
> > but it does the job for now.  Thank you.
> > --
> > Thanks.
> >
> >
> > "Joe Kaplan" wrote:
> >
> >> How about the static Domain.GetDomain method in
> >> System.DirectoryServices.ActiveDirectory?  That function takes a
> >> DirectoryContext which could contain alternate credentials, so it would
> >> be
> >> up to you to decide whether you want to rely on the current security
> >> context
> >> or prompt the user for different creds.
> >>
> >> Joe K.
> >>
> >> --
> >> Joe Kaplan-MS MVP Directory Services Programming
> >> Co-author of "The .NET Developer's Guide to Directory Services
> >> Programming"
> >> http://www.directoryprogramming.net
> >> --
> >> "Pucca" <Pu***@discussions.microsoft.com> wrote in message
> >> news:4586630D-B47D-466F-AD8B-0D32690F7BD6@microsoft.com...
> >> > Hi, I'm using vs2005 and C#.  In my application I am allowing the user
> >> > to
> >> > enter a string representing a domain that they would like the appl to
> >> > connect
> >> > to and build a TreeView control based on AD objects in the domain that
> >> > they
> >> > entered.  Is there a function that I can call to validate the string
> >> > that
> >> > the
> >> > user entered is a valid domain?
> >> >
> >> > --
> >> > Thanks.
> >>
> >>
> >>
>
>
>