public SPAlternateUrlCollectionInstance(ObjectInstance prototype, SPAlternateUrlCollection alternateUrlCollection) : this(prototype) { if (alternateUrlCollection == null) { throw new ArgumentNullException("alternateUrlCollection"); } m_alternateUrlCollection = alternateUrlCollection; }
private void ChangeZone() { if (Zone != SPUrlZone.Internet) { SPAlternateUrlCollection alternateUrls = WebApplication.AlternateUrls; SPAlternateUrl alternateurl = new SPAlternateUrl(Url, Zone); Uri internetRoot = null; try { internetRoot = WebApplication.GetResponseUri(Zone); } catch { internetRoot = null; } try { alternateurl = alternateUrls[Url]; if (alternateurl == null || alternateurl.UrlZone != SPUrlZone.Internet) { alternateurl = null; } } catch (Exception ex) { alternateurl = null; ex.ToString(); } if (_delete) { if (!string.IsNullOrEmpty(Url) && alternateurl != null) { try { alternateUrls.Delete(Url); } catch (Exception ex) { ex.ToString(); } finally { alternateUrls.Update(); } } } else { try { //No Internet Url defined; if (internetRoot == null) { if (!string.IsNullOrEmpty(Url)) { SPAlternateUrl defaultInternet = new SPAlternateUrl(Url, Zone); alternateUrls.SetResponseUrl(defaultInternet); } } // Incoming Urls else { SPAlternateUrl incomingUrl = new SPAlternateUrl(Url, Zone); alternateUrls.Add(incomingUrl); } } catch (Exception ex) { ex.ToString(); } finally { alternateUrls.Update(); } } } }