问题
Is there any way to monitor the availability of a domain, when the server is unknown at runtime? NetworkChange.NetworkAvailabilityChanged
, does not provide consistent results across framework versions/operating systems.
I'm dealing with mobile units on a domain, that are going to consistently lose and re-acquire domain connectivity; and I need to detect in code, when this happens.
I've tried Google, Bing, and MSDN and come up with nothing.
回答1:
Try using p/Invoke NetWkstaUserGetInfo
System.Environment.UserDomainName gets data from environment variable.
回答2:
You mean like the System.Environment.UserDomainName property?
来源:https://stackoverflow.com/questions/7755701/monitoring-domain-connectivity-status