private string GetFullyQualifiedDomainName() { return(NewOwaVirtualDirectory.GetFullyQualifiedDomainName(base.DomainController)); }
internal static string GetFullyQualifiedDomainName(string DomainController) { TaskLogger.LogEnter(); DirectoryEntry directoryEntry = null; DirectoryEntry directoryEntry2 = null; DirectorySearcher directorySearcher = null; SearchResultCollection searchResultCollection = null; int num; try { string path = NewOwaVirtualDirectory.LDAPPrefix(DomainController) + "RootDSE"; directoryEntry = new DirectoryEntry(path); directoryEntry2 = new DirectoryEntry(NewOwaVirtualDirectory.LDAPPrefix(DomainController) + directoryEntry.Properties["configurationNamingContext"].Value); directorySearcher = new DirectorySearcher(directoryEntry2); directorySearcher.Filter = "(&(objectClass=msExchRecipientPolicy)(msExchPolicyOrder=2147483647))"; directorySearcher.PropertiesToLoad.Add("gatewayProxy"); directorySearcher.SearchScope = SearchScope.Subtree; searchResultCollection = directorySearcher.FindAll(); foreach (object obj in searchResultCollection) { SearchResult searchResult = (SearchResult)obj; ResultPropertyValueCollection resultPropertyValueCollection = searchResult.Properties["gatewayProxy"]; foreach (object obj2 in resultPropertyValueCollection) { string text = obj2.ToString(); if (text.StartsWith("SMTP:")) { num = text.IndexOf('@'); if (num >= 0) { TaskLogger.LogExit(); return(text.Substring(num + 1)); } } } } } catch (COMException ex) { throw new IISGeneralCOMException(ex.Message, ex.ErrorCode, ex); } finally { if (searchResultCollection != null) { searchResultCollection.Dispose(); } if (directorySearcher != null) { directorySearcher.Dispose(); } if (directoryEntry2 != null) { directoryEntry2.Dispose(); } if (directoryEntry != null) { directoryEntry.Dispose(); } } TaskLogger.LogExit(); string hostName = Dns.GetHostName(); IPHostEntry hostEntry = Dns.GetHostEntry(hostName); string hostName2 = hostEntry.HostName; num = hostName2.IndexOf('.'); return((num >= 0 && num < hostName2.Length - 1) ? hostName2.Substring(num + 1) : hostName2); }
private string LDAPPrefix() { return(NewOwaVirtualDirectory.LDAPPrefix(base.DomainController)); }