Getting the domain name of the current server

  • Thread starter Thread starter Ron L
  • Start date Start date
R

Ron L

I have an application I am developing which is using remoting to have a
smart client connect to a remote database via IIS. There are certain
functions that we only want the user to be able to access if they are
members of a certain group on the server. When the application is deployed,
the group will be a domain group, but for our developers the group is a
local group on the development machines. To check the group membership, I
am using the HttpContext.Current.User.IsInRole(groupName) where groupname is
checked as
System.Environment.MachineName & "\" & groupname
and then as
<domainName> & "\" & groupname
My problem is how to get the domain name of the machine that is hosting the
remoting. In our development environment, the domain of the development
server is different from the domain the users are defined in, so we can't
use the System.Environment.UserDomainName.

Can anyone tell me how I can get the name of the domain that the remoting
host is a member of?

TIA
Ron Lounsbury
 
this is inelegant and I am sure that there is a better way, but...
why not just create a remotable object that returns this information to
callers?

there should also be a way to do this with Active Directory...
 
Stand__Sure
Thanks for the response. That is essentially what I am trying to do,
but I haven't been able to find a way to say "what domain is the server I am
on a member of".

Ron L
 
Have you solved this? I have the same problem except that my application can
be deployed to any computer. I need to determine, at runtime, whether to use
a local group or a domain group to form the group name for IsInRole.
 
Doug

No, I haven't come up with anything. For the moment I am coding around it
and moving on. If you find anything, I would be very interested.

Ron L
 
I resorted to using some Win32 code to call NetGetJoinInformation. That
gives me the computer's domain. I'm still trying both forms of group names
(System.Environment.MachineName & <domainName>). I'd like a way to avoid
that.
 
Back
Top