/// <summary> /// Handles OnAfterValidate event of the UI form. /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event argument</param> protected void Control_OnAfterValidate(object sender, EventArgs e) { if (siteInfo != null) { // Check for domain name collision if (siteInfo.Status == SiteStatusEnum.Running) { string domainName = ValidationHelper.GetString(Control.GetFieldValue("SiteDomainAliasName"), String.Empty); SiteInfo runningSite = SiteInfoProvider.GetRunningSiteInfo(domainName, null); if ((runningSite != null) && (siteInfo.SiteID != runningSite.SiteID)) { Control.StopProcessing = true; // Hide error message because user gets informed via confirmation Control.MessagesPlaceHolder.Visible = false; string postBackRef = ControlsHelper.GetPostBackEventReference(Control.ObjectManager.HeaderActions, "StopSite;"); string script = "if (confirm('" + ScriptHelper.GetString(ResHelper.GetStringFormat("sitedomain.proceedwithcollision", runningSite.DisplayName), false) + "')) { " + postBackRef + "; }"; ScriptHelper.RegisterStartupScript(Control.Page, typeof(string), "DomainCollisionMessage", ScriptHelper.GetScript(script)); } } // Remember the state of the site runAfterSave = (siteInfo.Status == SiteStatusEnum.Running); } }
private static void TrackReferral(string siteName) { string referrerURL = (RequestStockHelper.GetItem("AnalyticsReferrerString") as string); if (!string.IsNullOrEmpty(referrerURL)) { Uri referrer = new Uri(referrerURL); if ((referrer != null) && (CMSContext.ViewMode == ViewModeEnum.LiveSite)) { if (!referrer.AbsoluteUri.StartsWithCSafe("/") && !referrer.IsLoopback && (referrer.Host.ToLowerCSafe() != URLHelper.Url.Host)) { // Check other site domains SiteInfo rsi = SiteInfoProvider.GetRunningSiteInfo(referrer.Host, URLHelper.ApplicationPath); if ((rsi == null) || (rsi.SiteName != siteName)) { string path = URLHelper.RemoveQuery(referrer.AbsoluteUri); // Save the referrer value CMSContext.CurrentUser.URLReferrer = path; // Log referral string ip = HTTPHelper.UserHostAddress; HitLogProvider.LogHit(HitLogProvider.URL_REFERRALS, siteName, null, path, 0); } } } } }