protected void CmdSwitchClick(object sender, EventArgs e) { try { if ((!string.IsNullOrEmpty(SitesLst.SelectedValue))) { int selectedPortalID = int.Parse(SitesLst.SelectedValue); var portalAliasCtrl = new PortalAliasController(); ArrayList portalAliases = portalAliasCtrl.GetPortalAliasArrayByPortalID(selectedPortalID); if (((portalAliases != null) && portalAliases.Count > 0 && (portalAliases[0] != null))) { Response.Redirect(Globals.AddHTTP(((PortalAliasInfo)portalAliases[0]).HTTPAlias)); } } } catch (ThreadAbortException) { //Do nothing we are not logging ThreadAbortxceptions caused by redirects } catch (Exception ex) { Exceptions.LogException(ex); } }
BlogInfo[] IMetaWeblog.GetUsersBlogs(string key, string username, string password) { LocatePortal(Context.Request); DotNetNuke.Entities.Users.UserInfo ui = Authenticate(username, password); if (ui.UserID > 0) { //todo: configure blog info for users var infoList = new List <BlogInfo>(); var bi = new BlogInfo { blogid = "0" }; var pac = new PortalAliasController(); foreach (PortalAliasInfo api in pac.GetPortalAliasArrayByPortalID(PortalId)) { bi.url = "http://" + api.HTTPAlias; break; } bi.blogName = ui.Username; infoList.Add(bi); return(infoList.ToArray()); } throw new XmlRpcFaultException(0, Localization.GetString("FailedAuthentication.Text", LocalResourceFile)); }
/// <summary> /// FormatExpiryDate formats the format name as an a tag /// </summary> public string FormatPortalAliases(int portalID) { var str = new StringBuilder(); try { var objPortalAliasController = new PortalAliasController(); var arr = objPortalAliasController.GetPortalAliasArrayByPortalID(portalID); PortalAliasInfo objPortalAliasInfo; int i; for (i = 0; i <= arr.Count - 1; i++) { objPortalAliasInfo = (PortalAliasInfo)arr[i]; var httpAlias = Globals.AddHTTP(objPortalAliasInfo.HTTPAlias); var originalUrl = HttpContext.Current.Items["UrlRewrite:OriginalUrl"].ToString().ToLowerInvariant(); httpAlias = Globals.AddPort(httpAlias, originalUrl); str.Append("<a href=\"" + httpAlias + "\">" + objPortalAliasInfo.HTTPAlias + "</a>" + "<BR>"); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } return(str.ToString()); }
private void SetupBasePortalInfo() { PortalController pc = new PortalController(); int basePortalId = Convert.ToInt32(Settings["BasePortal"]); if (basePortalId < 0) { basePortalId = 0; } BasePortalInfo = pc.GetPortal(basePortalId); if (!BasePortalInfo.HomeDirectory.EndsWith("/")) { BasePortalInfo.HomeDirectory += "/"; } PortalAliasController pac = new PortalAliasController(); ArrayList aliases = pac.GetPortalAliasArrayByPortalID(basePortalId); PortalAliasInfo pai = (PortalAliasInfo)aliases[0]; OPTabId = DataProvider.Instance().GetFirstSCAOnlineOPTabId(); BasePortalSettings = new PortalSettings(OPTabId, pai); BasePortalHttpAddress = Globals.AddHTTP(pai.HTTPAlias); if (!BasePortalHttpAddress.EndsWith("/")) { BasePortalHttpAddress += "/"; } }
private void BindData() { ArrayList arr; PortalAliasController p = new PortalAliasController(); arr = p.GetPortalAliasArrayByPortalID(intPortalID); dgPortalAlias.DataSource = arr; dgPortalAlias.DataBind(); }
private void BindMarketing(PortalInfo portal) { //Load DocTypes var searchEngines = new Dictionary <string, string> { { "Google", "http://www.google.com/addurl?q=" + Globals.HTTPPOSTEncode(Globals.AddHTTP(Globals.GetDomainName(Request))) }, { "Yahoo", "http://siteexplorer.search.yahoo.com/submit" }, { "Microsoft", "http://search.msn.com.sg/docs/submit.aspx" } }; cboSearchEngine.DataSource = searchEngines; cboSearchEngine.DataBind(); var portalAliasController = new PortalAliasController(); var aliases = portalAliasController.GetPortalAliasArrayByPortalID(portal.PortalID); if (PortalController.IsChildPortal(portal, Globals.GetAbsoluteServerPath(Request))) { txtSiteMap.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + @"/SiteMap.aspx?portalid=" + portal.PortalID; } else { if (aliases.Count > 0) { //Get the first Alias var objPortalAliasInfo = (PortalAliasInfo)aliases[0]; txtSiteMap.Text = Globals.AddHTTP(objPortalAliasInfo.HTTPAlias) + @"/SiteMap.aspx"; } else { txtSiteMap.Text = Globals.AddHTTP(Globals.GetDomainName(Request)) + @"/SiteMap.aspx"; } } optBanners.SelectedIndex = portal.BannerAdvertising; if (UserInfo.IsSuperUser) { lblBanners.Visible = false; } else { optBanners.Enabled = portal.BannerAdvertising != 2; lblBanners.Visible = portal.BannerAdvertising == 2; } }
private void BindAliases(PortalInfo portal) { var portalSettings = new PortalSettings(portal); var portalAliasController = new PortalAliasController(); var aliases = portalAliasController.GetPortalAliasArrayByPortalID(portal.PortalID); var portalAliasMapping = portalSettings.PortalAliasMappingMode.ToString().ToUpper(); if (String.IsNullOrEmpty(portalAliasMapping)) { portalAliasMapping = "CANONICALURL"; } portalAliasModeButtonList.Select(portalAliasMapping, false); if (portalAliasMapping.ToUpperInvariant() == "NONE") { defaultAliasRow.Visible = false; } else { defaultAliasRow.Visible = true; defaultAliasDropDown.DataSource = aliases; defaultAliasDropDown.DataBind(); var defaultAlias = PortalController.GetPortalSetting("DefaultPortalAlias", portal.PortalID, ""); if (defaultAliasDropDown.Items.FindByValue(defaultAlias) != null) { defaultAliasDropDown.Items.FindByValue(defaultAlias).Selected = true; } } //Auto Add Portal Alias if (new PortalController().GetPortals().Count > 1) { chkAutoAddPortalAlias.Enabled = false; chkAutoAddPortalAlias.Checked = false; } else { chkAutoAddPortalAlias.Checked = HostController.Instance.GetBoolean("AutoAddPortalAlias"); } }
/// <summary> /// FormatExpiryDate formats the format name as an <a> tag /// </summary> /// <history> /// [cnurse] 9/28/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> public string FormatPortalAliases(int PortalID) { StringBuilder str = new StringBuilder(); try { PortalAliasController objPortalAliasController = new PortalAliasController(); ArrayList arr = objPortalAliasController.GetPortalAliasArrayByPortalID(PortalID); for (int i = 0; i < arr.Count; i++) { PortalAliasInfo objPortalAliasInfo = (PortalAliasInfo)arr[i]; str.Append("<a href=\"" + Globals.AddHTTP(objPortalAliasInfo.HTTPAlias) + "\">" + objPortalAliasInfo.HTTPAlias + "</a>" + "<BR>"); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } return(str.ToString()); }
private bool IsChildPortal(PortalSettings ps, HttpContext context) { var isChild = false; var aliasController = new PortalAliasController(); var arr = aliasController.GetPortalAliasArrayByPortalID(ps.PortalId); var serverPath = Globals.GetAbsoluteServerPath(context.Request); if (arr.Count > 0) { var portalAlias = (PortalAliasInfo)arr[0]; var portalName = Globals.GetPortalDomainName(ps.PortalAlias.HTTPAlias, Request, true); if (portalAlias.HTTPAlias.IndexOf("/") > -1) { portalName = PortalController.GetPortalFolder(portalAlias.HTTPAlias); } if (!string.IsNullOrEmpty(portalName) && Directory.Exists(serverPath + portalName)) { isChild = true; } } return(isChild); }
protected string GetFormattedLink(object dataItem) { var returnValue = new StringBuilder(); if ((dataItem is TabInfo)) { var tab = (TabInfo)dataItem; if ((tab != null)) { int index = 0; TabCtrl.PopulateBreadCrumbs(ref tab); foreach (TabInfo t in tab.BreadCrumbs) { if ((index > 0)) { returnValue.Append(" > "); } if ((tab.BreadCrumbs.Count - 1 == index)) { string url; var objPortalAliasController = new PortalAliasController(); ArrayList arr = objPortalAliasController.GetPortalAliasArrayByPortalID(t.PortalID); var objPortalAliasInfo = (PortalAliasInfo)arr[0]; //url = Globals.AddHTTP(objPortalAliasInfo.HTTPAlias) + "/Default.aspx?tabId=" + t.TabID; //Fariborz Khosravi url = Globals.AddHTTP(objPortalAliasInfo.HTTPAlias) + "/" + Globals.glbDefaultPage + "?tabId=" + t.TabID; returnValue.AppendFormat("<a href=\"{0}\">{1}</a>", url, t.LocalizedTabName); } else { returnValue.AppendFormat("{0}", t.LocalizedTabName); } index = index + 1; } } } return(returnValue.ToString()); }
private bool IsChildPortal(PortalSettings ps, HttpContext context) { bool isChild = false; string portalName = null; PortalAliasController aliasController = new PortalAliasController(); ArrayList arr = aliasController.GetPortalAliasArrayByPortalID(ps.PortalId); string serverPath = CommonLibrary.Common.Globals.GetAbsoluteServerPath(context.Request); if (arr.Count > 0) { PortalAliasInfo portalAlias = (PortalAliasInfo)arr[0]; portalName = CommonLibrary.Common.Globals.GetPortalDomainName(ps.PortalAlias.HTTPAlias, null, true); if (portalAlias.HTTPAlias.IndexOf("/") > -1) { portalName = portalAlias.HTTPAlias.Substring(portalAlias.HTTPAlias.LastIndexOf("/") + 1); } if (!string.IsNullOrEmpty(portalName) && System.IO.Directory.Exists(serverPath + portalName)) { isChild = true; } } return(isChild); }
private string GetLinkUrl(ref DialogParams dialogParams, string link) { ArrayList aliasList = _portalAliasController.GetPortalAliasArrayByPortalID(dialogParams.PortalId); if (dialogParams.LinkUrl.Contains(dialogParams.HomeDirectory)) { string filePath = dialogParams.LinkUrl.Substring(dialogParams.LinkUrl.IndexOf(dialogParams.HomeDirectory)).Replace(dialogParams.HomeDirectory, ""); var linkedFileId = FileManager.Instance.GetFile(dialogParams.PortalId, HttpUtility.UrlDecode(filePath)).FileId; link = string.Format("fileID={0}", linkedFileId); } else { foreach (PortalAliasInfo portalAlias in aliasList) { dialogParams.LinkUrl = dialogParams.LinkUrl.Replace(Globals.AddHTTP(portalAlias.HTTPAlias), ""); } string tabPath = dialogParams.LinkUrl.Replace("http://", "").Replace("/", "//").Replace(".aspx", ""); string cultureCode = Localization.SystemLocale; //get language info from url. var dicLocales = LocaleController.Instance.GetLocales(dialogParams.PortalId); foreach (var part in tabPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)) { if (dicLocales != null && part.IndexOf("-") > -1) { foreach (KeyValuePair <string, Locale> key in dicLocales) { if (key.Key.ToLower().Equals(part.ToLower())) { cultureCode = key.Value.Code; tabPath = tabPath.Replace("//" + part, string.Empty); break; } } } } //Try HumanFriendlyUrl TabPath link = TabController.GetTabByTabPath(dialogParams.PortalId, tabPath, cultureCode).ToString(); if (link == Null.NullInteger.ToString()) { //Try getting the tabId from the querystring string[] arrParams = dialogParams.LinkUrl.Split('/'); for (int i = 0; i < arrParams.Length; i++) { if (arrParams[i].ToLowerInvariant() == "tabid") { link = arrParams[i + 1]; break; } } if (link == Null.NullInteger.ToString()) { link = dialogParams.LinkUrl; } } } return(link); }
public void OnBeginRequest(object s, EventArgs e) { HttpApplication app = (HttpApplication)s; HttpServerUtility Server = app.Server; HttpRequest Request = app.Request; HttpResponse Response = app.Response; string requestedPath = app.Request.Url.AbsoluteUri; // URL validation // check for ".." escape characters commonly used by hackers to traverse the folder tree on the server // the application should always use the exact relative location of the resource it is requesting string strURL = Request.Url.AbsolutePath; string strDoubleDecodeURL = Server.UrlDecode(Server.UrlDecode(Request.RawUrl)); if (strURL.IndexOf("..") != -1 || strDoubleDecodeURL.IndexOf("..") != -1) { throw (new HttpException(404, "Not Found")); } //fix for ASP.NET canonicalization issues http://support.microsoft.com/?kbid=887459 if (Request.Path.IndexOf('\u005C') >= 0 || Path.GetFullPath(Request.PhysicalPath) != Request.PhysicalPath) { throw (new HttpException(404, "Not Found")); } //check if we are upgrading/installing if (Request.Url.LocalPath.ToLower().EndsWith("install.aspx")) { return; } // save original url in context app.Context.Items.Add("UrlRewrite:OriginalUrl", app.Request.Url.AbsoluteUri); // Friendly URLs are exposed externally using the following format // http://www.domain.com/tabid/###/mid/###/ctl/xxx/default.aspx // and processed internally using the following format // http://www.domain.com/default.aspx?tabid=###&mid=###&ctl=xxx // The system for accomplishing this is based on an extensible Regex rules definition stored in /SiteUrls.config string sendTo = ""; // save and remove the querystring as it gets added back on later // path parameter specifications will take precedence over querystring parameters string strQueryString = ""; if (!String.IsNullOrEmpty(app.Request.Url.Query)) { strQueryString = Request.QueryString.ToString(); requestedPath = requestedPath.Replace(app.Request.Url.Query, ""); } // get url rewriting rules RewriterRuleCollection rules = RewriterConfiguration.GetConfig().Rules; // iterate through list of rules int intMatch = -1; for (int intRule = 0; intRule <= rules.Count - 1; intRule++) { // check for the existence of the LookFor value string strLookFor = "^" + RewriterUtils.ResolveUrl(app.Context.Request.ApplicationPath, rules[intRule].LookFor) + "$"; Regex objLookFor = new Regex(strLookFor, RegexOptions.IgnoreCase); // if there is a match if (objLookFor.IsMatch(requestedPath)) { // create a new URL using the SendTo regex value sendTo = RewriterUtils.ResolveUrl(app.Context.Request.ApplicationPath, objLookFor.Replace(requestedPath, rules[intRule].SendTo)); // obtain the RegEx match group which contains the parameters Match objMatch = objLookFor.Match(requestedPath); string strParameters = objMatch.Groups[2].Value; // process the parameters if (strParameters.Trim(null).Length > 0) { // split the value into an array based on "/" ( ie. /tabid/##/ ) strParameters = strParameters.Replace("\\", "/"); string[] arrParameters = strParameters.Split('/'); string strParameterDelimiter; string strParameterName; string strParameterValue; // icreate a well formed querystring based on the array of parameters for (int intParameter = 1; intParameter <= arrParameters.Length - 1; intParameter++) { // ignore the page name if (arrParameters[intParameter].ToLower().IndexOf(".aspx") == -1) { // get parameter name strParameterName = arrParameters[intParameter].Trim(null); if (strParameterName.Length > 0) { // add parameter to SendTo if it does not exist already if (sendTo.ToLower().IndexOf("?" + strParameterName.ToLower()) == -1 && sendTo.ToLower().IndexOf("&" + strParameterName.ToLower()) == -1) { // get parameter delimiter if (sendTo.IndexOf("?") != -1) { strParameterDelimiter = "&"; } else { strParameterDelimiter = "?"; } sendTo = sendTo + strParameterDelimiter + strParameterName; // get parameter value strParameterValue = ""; if (intParameter < (arrParameters.Length - 1)) { intParameter++; if (arrParameters[intParameter].Trim() != "") { strParameterValue = arrParameters[intParameter].Trim(null); } } // add the parameter value if (strParameterValue.Length > 0) { sendTo = sendTo + "=" + strParameterValue; } } } } } } intMatch = intRule; break; // exit as soon as it processes the first match } } // add querystring parameters back to SendTo if (!String.IsNullOrEmpty(strQueryString)) { string[] arrParameters = strQueryString.Split('&'); // iterate through the array of parameters for (int intParameter = 0; intParameter <= arrParameters.Length - 1; intParameter++) { // get parameter name string strParameterName = arrParameters[intParameter]; if (strParameterName.IndexOf("=") != -1) { strParameterName = strParameterName.Substring(0, strParameterName.IndexOf("=")); } // check if parameter already exists if (sendTo.ToLower().IndexOf("?" + strParameterName.ToLower()) == -1 && sendTo.ToLower().IndexOf("&" + strParameterName.ToLower()) == -1) { // add parameter to SendTo value if (sendTo.IndexOf("?") != -1) { sendTo = sendTo + "&" + arrParameters[intParameter]; } else { sendTo = sendTo + "?" + arrParameters[intParameter]; } } } } // if a match was found to the urlrewrite rules if (intMatch != -1) { if (rules[intMatch].SendTo.StartsWith("~")) { // rewrite the URL for internal processing RewriterUtils.RewriteUrl(app.Context, sendTo); } else { // it is not possible to rewrite the domain portion of the URL so redirect to the new URL Response.Redirect(sendTo, true); } } // *Note: from this point on we are dealing with a "standard" querystring ( ie. http://www.domain.com/default.aspx?tabid=## ) int TabId = -1; int PortalId = -1; string DomainName = null; string PortalAlias = null; PortalAliasInfo objPortalAliasInfo; // get TabId from querystring ( this is mandatory for maintaining portal context for child portals ) try { if (!(Request.QueryString["tabid"] == null)) { TabId = int.Parse(Request.QueryString["tabid"]); } // get PortalId from querystring ( this is used for host menu options as well as child portal navigation ) if (!(Request.QueryString["portalid"] == null)) { PortalId = int.Parse(Request.QueryString["portalid"]); } } catch (Exception) { //The tabId or PortalId are incorrectly formatted (potential DOS) throw (new HttpException(404, "Not Found")); } // alias parameter can be used to switch portals if (!(Request.QueryString["alias"] == null)) { // check if the alias is valid if (PortalSettings.GetPortalAliasInfo(Request.QueryString["alias"]) != null) { // check if the domain name contains the alias if (Strings.InStr(1, Request.QueryString["alias"], DomainName, CompareMethod.Text) == 0) { // redirect to the url defined in the alias Response.Redirect(Globals.GetPortalDomainName(Request.QueryString["alias"], Request, true)); } else // the alias is the same as the current domain { PortalAlias = Request.QueryString["alias"]; } } } // parse the Request URL into a Domain Name token DomainName = Globals.GetDomainName(Request); // PortalId identifies a portal when set if (PortalAlias == null) { if (PortalId != -1) { PortalAlias = PortalSettings.GetPortalByID(PortalId, DomainName); } } // TabId uniquely identifies a Portal if (PortalAlias == null) { if (TabId != -1) { // get the alias from the tabid, but only if it is for a tab in that domain PortalAlias = PortalSettings.GetPortalByTab(TabId, DomainName); if (PortalAlias == null || PortalAlias == "") { //if the TabId is not for the correct domain //see if the correct domain can be found and redirect it objPortalAliasInfo = PortalSettings.GetPortalAliasInfo(DomainName); if (objPortalAliasInfo != null) { if (app.Request.Url.AbsoluteUri.ToLower().StartsWith("https://")) { strURL = "https://" + objPortalAliasInfo.HTTPAlias.Replace("*.", ""); } else { strURL = "http://" + objPortalAliasInfo.HTTPAlias.Replace("*.", ""); } if (strURL.ToLower().IndexOf(DomainName.ToLower()) == -1) { strURL += app.Request.Url.PathAndQuery; } Response.Redirect(strURL, true); } } } } // else use the domain name if (PortalAlias == null || PortalAlias == "") { PortalAlias = DomainName; } //using the DomainName above will find that alias that is the domainname portion of the Url //ie. dotnetnuke.com will be found even if zzz.dotnetnuke.com was entered on the Url objPortalAliasInfo = PortalSettings.GetPortalAliasInfo(PortalAlias); if (objPortalAliasInfo != null) { PortalId = objPortalAliasInfo.PortalID; } // if the portalid is not known if (PortalId == -1) { if (!Request.Url.LocalPath.ToLower().EndsWith(Globals.glbDefaultPage.ToLower())) { // allows requests for aspx pages in custom folder locations to be processed return; } else { //the domain name was not found so try using the host portal's first alias if (Convert.ToString(Globals.HostSettings["HostPortalId"]) != "") { PortalId = Convert.ToInt32(Globals.HostSettings["HostPortalId"]); // use the host portal PortalAliasController objPortalAliasController = new PortalAliasController(); ArrayList arrPortalAliases; arrPortalAliases = objPortalAliasController.GetPortalAliasArrayByPortalID(int.Parse(Convert.ToString(Globals.HostSettings["HostPortalId"]))); if (arrPortalAliases.Count > 0) { //Get the first Alias objPortalAliasInfo = (PortalAliasInfo)arrPortalAliases[0]; if (app.Request.Url.AbsoluteUri.ToLower().StartsWith("https://")) { strURL = "https://" + objPortalAliasInfo.HTTPAlias.Replace("*.", ""); } else { strURL = "http://" + objPortalAliasInfo.HTTPAlias.Replace("*.", ""); } if (TabId != -1) { strURL += app.Request.Url.Query; } Response.Redirect(strURL, true); } } } } if (PortalId != -1) { // load the PortalSettings into current context PortalSettings _portalSettings = new PortalSettings(TabId, objPortalAliasInfo); app.Context.Items.Add("PortalSettings", _portalSettings); } else { // alias does not exist in database // and all attempts to find another have failed //this should only happen if the HostPortal does not have any aliases StreamReader objStreamReader; objStreamReader = File.OpenText(Server.MapPath("~/404.htm")); string strHTML = objStreamReader.ReadToEnd(); objStreamReader.Close(); strHTML = strHTML.Replace("[DOMAINNAME]", DomainName); Response.Write(strHTML); Response.End(); } }
/// <summary> /// Given a rule, returns a redirect location /// </summary> /// <param name="redirectInfo"></param> /// <param name="redirectUrl"></param> /// <returns></returns> internal static string RedirectLocation(UrlRedirectProvider provider, RedirectInfo redirectInfo, string redirectUrl, string scheme, NameValueCollection queryString, ref List <string> messages) { string destinationUrl = ""; switch (redirectInfo.DestType.ToLower()) { case "tab": string path = redirectInfo.DestUrl; if (redirectInfo.DestTabId > -1) { //construct the portal settings required for the destination PortalAliasController pac = new PortalAliasController(); PortalAliasInfo pa = null; if (string.IsNullOrEmpty(redirectInfo.HttpAlias)) { var aliases = pac.GetPortalAliasArrayByPortalID(redirectInfo.PortalId); foreach (PortalAliasInfo alias in aliases) { if (alias.IsPrimary) { pa = alias; break; } } //safety check for failed alias if (pa == null) { throw new NullReferenceException( "Either Redirect HttpAlias must be specified for DestType of 'Tab', or this portal must have a primary alias. Redirect Id : " + redirectInfo.RedirectId.ToString()); } } else { //get this specific alias pa = pac.GetPortalAlias(redirectInfo.HttpAlias, redirectInfo.PortalId); } //create a new portal settings object with this alias PortalSettings ps = new PortalSettings(redirectInfo.DestTabId, pa); //build the redirect path if (string.IsNullOrEmpty(path) == false) { //add a url path onto the url created for the tab string qs; SplitPathAndQuerystring(path, out path, out qs); path = provider.EnsureNotLeadingChar("/", path); //now call down to the navigate url destinationUrl = DotNetNuke.Common.Globals.NavigateURL(redirectInfo.DestTabId, ps, "", path); if (queryString != null && queryString.Count > 0) { destinationUrl = AddQueryString(destinationUrl, queryString); } //check for querystring preservation if (redirectInfo.KeepQueryString && qs != null) { //put the querystring back on, if it existed destinationUrl = AddQueryString(destinationUrl, qs); messages.Add("URP: Redirecting " + redirectUrl + " to " + destinationUrl + " by tab + path + qs. RuleId: " + redirectInfo.RedirectId.ToString()); } else { messages.Add("URP: Redirecting " + redirectUrl + " to " + destinationUrl + " by tab + path. RuleId: " + redirectInfo.RedirectId.ToString()); } } else { //no path -just the tab destinationUrl = DotNetNuke.Common.Globals.NavigateURL(redirectInfo.DestTabId, ps, ""); if (redirectInfo.KeepQueryString && queryString != null && queryString.Count > 0) { destinationUrl = AddQueryString(destinationUrl, queryString); messages.Add("URP: Redirecting " + redirectUrl + " to " + destinationUrl + " by tab + qs. RuleId: " + redirectInfo.RedirectId.ToString()); } else { messages.Add("URP: Redirecting " + redirectUrl + " to " + destinationUrl + " by tab. RuleId: " + redirectInfo.RedirectId.ToString()); } } } break; case "url": destinationUrl = redirectInfo.DestUrl; if (Regex.IsMatch(destinationUrl, @"^https?://", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant) == false) { //no scheme, add on supplied scheme destinationUrl = scheme + Uri.SchemeDelimiter + destinationUrl; } //keep query string from redirect destination if (redirectInfo.KeepQueryString) { destinationUrl = AddQueryString(destinationUrl, queryString); messages.Add("URP: Redirecting " + redirectUrl + " to " + destinationUrl + " by url + qs. RuleId: " + redirectInfo.RedirectId.ToString()); } else { messages.Add("URP: Redirecting " + redirectUrl + " to " + destinationUrl + " by url. RuleId: " + redirectInfo.RedirectId.ToString()); } try { Uri redirectUri = new Uri(destinationUrl); } catch (Exception invalidEx) { messages.Add("Invalid redirect URL '" + redirectUrl + "'. Message: " + invalidEx.Message); throw; } break; } return(destinationUrl); }