public void DeleteUrl(VanityUrlInfo VanityUrl) { if (ValidateAuthentication()) { VanityUrlController.DeleteUrl(VanityUrl); } }
public void RemoveGoogleTrackingType(GoogleTrackInfo googleTrackInfo) { if (ValidateAuthentication()) { VanityUrlController.RemoveGoogleTrackingType(googleTrackInfo); } }
public VanityUrlInfo SaveUrl(VanityUrlInfo VanityUrl) { if (ValidateAuthentication()) { return(VanityUrlController.SaveUrl(VanityUrl)); } return(null); }
public List <VanityUrlInfo> GetVanityUrlsXml() { if (ValidateAuthentication()) { return(VanityUrlController.GetVanityURLs()); } return(null); }
public List <GoogleTrackInfo> GetGoogleTrackingTypes() { if (ValidateAuthentication()) { return(VanityUrlController.GetGoogleTrackingTypes()); } return(null); }
public void UpdateGoogleTrackingType(GoogleTrackInfo googleTrackInfo) { if (ValidateAuthentication()) { if (googleTrackInfo.Value != "") { VanityUrlController.UpdateGoogleTrackingType(googleTrackInfo); } } }
/// <summary> /// Determines when to do a redirect. This is separate to the rewriting process. The module developer can create any type of Url redirect here, because the entire Url of the original request is passed in. /// </summary> /// <param name="tabId">Identified TabId, if known. -1 if no valid tabid identified.</param> /// <param name="portalid">Identified portalId.</param> /// <param name="httpAlias">Identified httpAlias of the request.</param> /// <param name="requestUri">The original requested Url</param> /// <param name="queryStringCol">The querystring collection of the original request</param> /// <param name="options">The friendly url options that currently apply.</param> /// <param name="redirectLocation">Out parameter that shows where to redirect to.</param> /// <param name="messages">List of messages for debug purposes. Add to this list to help debug your module.</param> /// <returns>true if 301 redirect is required, false if not. If true, the redirectLocation value must be a valid fully qualified Url.</returns> public override bool CheckForRedirect(int tabId, int portalid, string httpAlias, Uri requestUri, System.Collections.Specialized.NameValueCollection queryStringCol, iFinity.DNN.Modules.UrlMaster.FriendlyUrlOptions options, out string redirectLocation, ref List <string> messages) { bool doRedirect = false; redirectLocation = "";//set blank location //compare to known pattern of old Urls //could be in old /itemid/xx format - if so, we want to redirect it string urlWithoutAlias = requestUri.AbsoluteUri.Replace(httpAlias, "").Replace(requestUri.Scheme + "://", ""); if (urlWithoutAlias.StartsWith("/")) { urlWithoutAlias = urlWithoutAlias.Substring(1); } //Check Database / Cache for the key. //Redirect if key found. foreach (VanityUrlInfo urlInfo in VanityUrlController.GetVanityURLs(portalid)) { if (urlInfo.VanityUrl.ToLower() == urlWithoutAlias.ToLower()) { if ((urlInfo.ActiveStartDate == null || urlInfo.ActiveStartDate < DateTime.Now) && (urlInfo.ActiveEndDate == null || urlInfo.ActiveEndDate > DateTime.Now)) { doRedirect = true; redirectLocation = requestUri.Scheme + "://" + httpAlias + urlInfo.RedirectUrl; VanityUrlController.UpdateLastAccessedDate(urlInfo, portalid); break; } else { break; } } } return(doRedirect); }
/// <summary> /// Called when [begin request]. /// </summary> /// <param name="source">The source.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> public void OnBeginRequest(Object source, EventArgs e) { try { var app = (HttpApplication)source; var context = app.Context; var myAlias = DotNetNuke.Common.Globals.GetDomainName(app.Request, true); bool doRedirect = false; string redirectLocation = ""; //set blank location string requestUri = context.Request.Url.AbsoluteUri; string scheme = context.Request.Url.Scheme; //Taken from the BasicUrlRewriter to skip directly if (context.Request.Url.LocalPath.ToLower().EndsWith("/install/install.aspx") || context.Request.Url.LocalPath.ToLower().Contains("/install/upgradewizard.aspx") || context.Request.Url.LocalPath.ToLower().Contains("/install/installwizard.aspx") || context.Request.Url.LocalPath.ToLower().EndsWith("captcha.aspx") || context.Request.Url.LocalPath.ToLower().EndsWith("scriptresource.axd") || context.Request.Url.LocalPath.ToLower().EndsWith("webresource.axd")) { return; } //Strip down the URL slash by slash to get the PortalAlias PortalAliasInfo objPortalAlias; do { objPortalAlias = PortalAliasController.GetPortalAliasInfo(myAlias); if (objPortalAlias != null) { break; } int slashIndex = myAlias.LastIndexOf('/'); myAlias = slashIndex > 1 ? myAlias.Substring(0, slashIndex) : ""; } while (myAlias.Length > 0); string urlWithoutAlias = requestUri.Replace(myAlias, "").Replace(scheme + "://", ""); if (urlWithoutAlias.StartsWith("/")) { urlWithoutAlias = urlWithoutAlias.Substring(1); } //Check Database / Cache for the key. //Redirect if key found. int portalId = PortalAliasController.GetPortalAliasInfo(myAlias).PortalID; foreach (VanityUrlInfo urlInfo in VanityUrlController.GetVanityURLs(portalId)) { if (urlInfo.VanityUrl.ToLower() == urlWithoutAlias.ToLower()) { if ((urlInfo.ActiveStartDate == null || urlInfo.ActiveStartDate < DateTime.Now) && (urlInfo.ActiveEndDate == null || urlInfo.ActiveEndDate > DateTime.Now)) { doRedirect = true; redirectLocation = scheme + "://" + myAlias + urlInfo.RedirectUrl; //TODO: Test this. Not sure it actaully works VanityUrlController.UpdateLastAccessedDate(urlInfo, portalId); } break; } } if (doRedirect) { context.Response.Redirect(redirectLocation); } } catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); } }