diff --git a/DNN Platform/Library/Common/Utilities/StringExtensions.cs b/DNN Platform/Library/Common/Utilities/StringExtensions.cs index 22556d92847..3100c0a60ed 100644 --- a/DNN Platform/Library/Common/Utilities/StringExtensions.cs +++ b/DNN Platform/Library/Common/Utilities/StringExtensions.cs @@ -1,4 +1,5 @@ using System.Text; +using System.Text.RegularExpressions; namespace DotNetNuke.Common.Utilities { @@ -41,6 +42,22 @@ public static string NormalizeString(this string input) : Iso8859Encoding.GetString(Encoding.Convert(Encoding.UTF8, Iso8859Encoding, Encoding.UTF8.GetBytes(input))).ToLowerInvariant(); } + /// + /// Alternative to that supports case insensitive replacement + /// + /// The source. + /// The old value. + /// The new value. + /// + public static string ReplaceIgnoreCase(this string source, string oldValue, string newValue) + { + if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(oldValue) || oldValue.Equals(newValue, System.StringComparison.OrdinalIgnoreCase)) + { + return source; + } + return Regex.Replace(source, Regex.Escape(oldValue), newValue, RegexOptions.IgnoreCase); + } + private static readonly Encoding Iso8859Encoding = Encoding.GetEncoding("iso-8859-8"); } diff --git a/DNN Platform/Library/Entities/Urls/AdvancedUrlRewriter.cs b/DNN Platform/Library/Entities/Urls/AdvancedUrlRewriter.cs index 8604a5fdd95..9934995cb8e 100644 --- a/DNN Platform/Library/Entities/Urls/AdvancedUrlRewriter.cs +++ b/DNN Platform/Library/Entities/Urls/AdvancedUrlRewriter.cs @@ -57,6 +57,7 @@ public class AdvancedUrlRewriter : UrlRewriterBase private static readonly Regex AumDebugRegex = new Regex(@"(&|\?)_aumdebug=[A-Z]+(?:&|$)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); private static readonly Regex RewritePathRx = new Regex("(?:&(?.[^&]+)=$)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); private static readonly Regex UrlSlashesRegex = new Regex("[\\\\/]\\.\\.[\\\\/]", RegexOptions.Compiled); + private static readonly Regex AliasUrlRegex = new Regex(@"(?:^(?http[s]{0,1}://){0,1})(?:(?_ALIAS_)(?$|\?[\w]*|/[\w]*))", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); #region Private Members @@ -152,31 +153,53 @@ public void ProcessTestRequestWithContext(HttpContext context, private PortalAliasInfo GetPortalAlias(FriendlyUrlSettings settings, string requestUrl, out bool redirectAlias, out bool isPrimaryAlias, out string wrongAlias) { - PortalAliasInfo alias = null; + PortalAliasInfo aliasInfo = null; redirectAlias = false; wrongAlias = null; isPrimaryAlias = false; - OrderedDictionary portalRegexes = TabIndexController.GetPortalAliasRegexes(settings); - foreach (string regexPattern in portalRegexes.Keys) + OrderedDictionary portalAliases = TabIndexController.GetPortalAliases(settings); + foreach (string alias in portalAliases.Keys) { - //split out the portal alias from the regex pattern representing that alias - var regex = RegexUtils.GetCachedRegex(regexPattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); - var aliasMatch = regex.Match(requestUrl); + var urlToMatch = requestUrl; + // in fact, requested url should contain alias + // for better performance, need to check whether we want to proceed with a whole url matching or not + // if alias is not a part of url -> let's proceed to the next iteration + var aliasIndex = urlToMatch.IndexOf(alias, StringComparison.InvariantCultureIgnoreCase); + if (aliasIndex < 0) + { + continue; + } + else + { + // we do not accept URL if the first occurence of alias is presented somewhere in the query string + var queryIndex = urlToMatch.IndexOf("?", StringComparison.InvariantCultureIgnoreCase); + if (queryIndex >= 0 && queryIndex < aliasIndex) + { + // alias is in the query string, go to the next alias + continue; + } + // we are fine here, lets prepare URL to be validated in regex + urlToMatch = urlToMatch.ReplaceIgnoreCase(alias, "_ALIAS_"); + } + // check whether requested URL has the right URL format containing existing alias + // i.e. url is http://dnndev.me/site1/query?string=test, alias is dnndev.me/site1 + // in the below expression we will validate following value http://_ALIAS_/query?string=test + var aliasMatch = AliasUrlRegex.Match(urlToMatch); if (aliasMatch.Success) { //check for mobile browser and matching - var aliasEx = (PortalAliasInfo)portalRegexes[regexPattern]; + var aliasEx = (PortalAliasInfo)portalAliases[alias]; redirectAlias = aliasEx.Redirect; if (redirectAlias) { - wrongAlias = aliasMatch.Groups["alias"].Value; + wrongAlias = alias; } isPrimaryAlias = aliasEx.IsPrimary; - alias = aliasEx; + aliasInfo = aliasEx; break; } } - return alias; + return aliasInfo; } private void ProcessRequest(HttpContext context, diff --git a/DNN Platform/Library/Entities/Urls/CacheController.cs b/DNN Platform/Library/Entities/Urls/CacheController.cs index c7aea039e99..7b6eb5d9ad8 100644 --- a/DNN Platform/Library/Entities/Urls/CacheController.cs +++ b/DNN Platform/Library/Entities/Urls/CacheController.cs @@ -63,7 +63,7 @@ public class CacheController private const string FriendlyUrlSettingsKey = "url_FriendlyUrlSettings"; private const string RedirectActionsKey = "url_ParameterRedirectActions_{0}"; private const string RewriteActionsKey = "url_ParameterRewriteActions_{0}"; - private const string PortalAliasRegexesKey = "url_PortalAliasRegex"; + private const string PortalAliasesKey = "url_PortalAliases"; private const string UserProfileActionsKey = "url_UserProfileActions"; private const string PortalModuleProvidersForTabKey = "url_ModuleProvidersForTab_{0}_{1}"; private const string PortalModuleProvidersAllTabsKey = "url_ModuleProvidersAllTabs_{0}"; @@ -433,9 +433,9 @@ internal static Dictionary> GetParameter return rewriteActions; } - internal static OrderedDictionary GetPortalAliasesRegexesFromCache() + internal static OrderedDictionary GetPortalAliasesFromCache() { - object raw = DataCache.GetCache(PortalAliasRegexesKey); + object raw = DataCache.GetCache(PortalAliasesKey); return (raw != null) ? (OrderedDictionary)raw : null; } @@ -760,9 +760,9 @@ internal static void StorePortalAliasesInCache(SharedDictionary tabPathDictionary, FriendlyUrlSettings settings) @@ -791,7 +791,7 @@ public static void FlushPageIndexFromCache() DataCache.RemoveCache(UrlPortalsKey); DataCache.RemoveCache(UserProfileActionsKey); DataCache.RemoveCache(PortalAliasListKey); - DataCache.RemoveCache(PortalAliasRegexesKey); + DataCache.RemoveCache(PortalAliasesKey); DataCache.RemoveCache(TabPathsKey); } diff --git a/DNN Platform/Library/Entities/Urls/TabIndexController.cs b/DNN Platform/Library/Entities/Urls/TabIndexController.cs index 6c73bd9ca2c..4fc5a955d78 100644 --- a/DNN Platform/Library/Entities/Urls/TabIndexController.cs +++ b/DNN Platform/Library/Entities/Urls/TabIndexController.cs @@ -936,7 +936,7 @@ private static void AddToTabDict(SharedDictionary tabIndex, } } - private static OrderedDictionary BuildPortalAliasesRegexDictionary() + private static OrderedDictionary BuildPortalAliasesDictionary() { var aliases = PortalAliasController.Instance.GetPortalAliases(); //create a new OrderedDictionary. We use this because we @@ -944,18 +944,14 @@ private static OrderedDictionary BuildPortalAliasesRegexDictionary() //portalAlias that matches, and we want to preserve the //order of the items, such that the item with the most path separators (/) //is at the front of the list. - var regexList = new OrderedDictionary(aliases.Count); - //this regex pattern, when formatted with the httpAlias, will match a request - //for this portalAlias - const string aliasRegexPattern = @"(?:^(?http[s]{0,1}://){0,1})(?:(?_ALIAS_)(?$|\?[\w]*|/[\w]*))"; + var aliasList = new OrderedDictionary(aliases.Count); var pathLengths = new List(); foreach (string aliasKey in aliases.Keys) { PortalAliasInfo alias = aliases[aliasKey]; //regex escape the portal alias for inclusion into a regex pattern string plainAlias = alias.HTTPAlias; - string escapedAlias = Regex.Escape(plainAlias); - var aliasesToAdd = new List { escapedAlias }; + var aliasesToAdd = new List { plainAlias }; //check for existence of www. version of domain, if it doesn't have a www. if (plainAlias.StartsWith("www.", StringComparison.InvariantCultureIgnoreCase)) { @@ -965,7 +961,7 @@ private static OrderedDictionary BuildPortalAliasesRegexDictionary() if (!aliases.Contains(noWWWVersion)) { //there is no no-www version of the alias - aliasesToAdd.Add(Regex.Escape(noWWWVersion)); + aliasesToAdd.Add(noWWWVersion); } } } @@ -974,7 +970,7 @@ private static OrderedDictionary BuildPortalAliasesRegexDictionary() string wwwVersion = "www." + plainAlias; if (!aliases.Contains(wwwVersion)) { - aliasesToAdd.Add(Regex.Escape(wwwVersion)); + aliasesToAdd.Add(wwwVersion); } } int count = 0; @@ -984,8 +980,6 @@ private static OrderedDictionary BuildPortalAliasesRegexDictionary() count++; var aliasObject = new PortalAliasInfo(alias) { Redirect = count != 1 }; - //format up the regex pattern by replacing the alias portion with the portal alias name - string regexPattern = aliasRegexPattern.Replace("_ALIAS_", aliasToAdd); //work out how many path separators there are in the portalAlias (ie myalias/mychild = 1 path) int pathLength = plainAlias.Split('/').GetUpperBound(0); //now work out where in the list we should put this portalAlias regex pattern @@ -1008,18 +1002,18 @@ private static OrderedDictionary BuildPortalAliasesRegexDictionary() if (pathLengths.Count > 0 && insertPoint <= pathLengths.Count - 1) { //put the new regex pattern into the correct position - regexList.Insert(insertPoint, regexPattern, aliasObject); + aliasList.Insert(insertPoint, aliasToAdd, aliasObject); pathLengths.Insert(insertPoint, pathLength); } else { //put the new regex pattern on the end of the list - regexList.Add(regexPattern, aliasObject); + aliasList.Add(aliasToAdd, aliasObject); pathLengths.Add(pathLength); } } } - return regexList; + return aliasList; } private static SharedDictionary BuildTabDictionary(out PathSizes pathSizes, @@ -1628,16 +1622,16 @@ internal static PortalAliasInfo GetPortalAliasByPortal(int portalId, string port /// Returns an ordered dictionary of alias regex patterns. These patterns are used to identify a portal alias by getting a match. /// /// - internal static OrderedDictionary GetPortalAliasRegexes(FriendlyUrlSettings settings) + internal static OrderedDictionary GetPortalAliases(FriendlyUrlSettings settings) { //object to return - OrderedDictionary regexList = CacheController.GetPortalAliasesRegexesFromCache(); - if (regexList == null) + OrderedDictionary aliasList = CacheController.GetPortalAliasesFromCache(); + if (aliasList == null) { - regexList = BuildPortalAliasesRegexDictionary(); - CacheController.StorePortalAliasesRegexesInCache(regexList, settings); + aliasList = BuildPortalAliasesDictionary(); + CacheController.StorePortalAliasesInCache(aliasList, settings); } - return regexList; + return aliasList; } /// diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Urls/FriendlyUrlTests.cs b/DNN Platform/Tests/DotNetNuke.Tests.Urls/FriendlyUrlTests.cs index a5d6ee44abe..809120043e9 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Urls/FriendlyUrlTests.cs +++ b/DNN Platform/Tests/DotNetNuke.Tests.Urls/FriendlyUrlTests.cs @@ -229,7 +229,7 @@ private void ExecuteTestForTab(string test, TabInfo tab, FriendlyUrlSettings set Guid.Empty); } - Assert.AreEqual(expectedResult, testUrl); + Assert.IsTrue(expectedResult.Equals(testUrl, StringComparison.InvariantCultureIgnoreCase)); } private void UpdateTabName(int tabId, string newName) diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Aliases.csv b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Aliases.csv index f9266360172..3f1f36db844 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Aliases.csv +++ b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Aliases.csv @@ -2,4 +2,5 @@ myalias.com, Parent mychildalias.com/child, Child 192.168.1.1, IPAdress -localhost/vdir, VirtualDirectory \ No newline at end of file +localhost/vdir, VirtualDirectory +MyAliasMultiCase.Com, MultiCase \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/FriendlyUrl/VanityUrl/TestFile.csv b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/FriendlyUrl/VanityUrl/TestFile.csv index 31d4cdde29e..3973cb0ef30 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/FriendlyUrl/VanityUrl/TestFile.csv +++ b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/FriendlyUrl/VanityUrl/TestFile.csv @@ -1,5 +1,5 @@ Test, UserName, VanityUrl, VanityUrlPrefix, Scheme, Page Name, Params, Expected Url, -No Vanity Url, test, , , http://, Activity Feed, &UserId={userId}, http://{alias}/ActivityFeed/UserId/{userId} -Vanity Url Default, test, testuser, , http://, Activity Feed, &UserId={userId}, http://{alias}/users/{vanityUrl} -Vanity Url members, test, testuser, members, http://, Activity Feed, &UserId={userId}, http://{alias}/members/{vanityUrl} -Vanity Url Messages, test, testuser, , http://, Messages, &UserId={userId}, http://{alias}/users/{vanityUrl}/Messages +No Vanity Url, test1, , , http://, Activity Feed, &UserId={userId}, http://{alias}/ActivityFeed/UserId/{userId} +Vanity Url Default, test1, testuser, , http://, Activity Feed, &UserId={userId}, http://{alias}/users/{vanityUrl} +Vanity Url members, test1, testuser, members, http://, Activity Feed, &UserId={userId}, http://{alias}/members/{vanityUrl} +Vanity Url Messages, test1, testuser, , http://, Messages, &UserId={userId}, http://{alias}/users/{vanityUrl}/Messages diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/UrlRewrite/VanityUrl/TestFile.csv b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/UrlRewrite/VanityUrl/TestFile.csv index 890f4a33bb5..70668a2171b 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/UrlRewrite/VanityUrl/TestFile.csv +++ b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/UrlRewrite/VanityUrl/TestFile.csv @@ -1,18 +1,18 @@ Test, UserName, RedirectOldProfileUrl, VanityUrl, Scheme, Page Name, Test Url, Expected Url, Status, Final Url, RedirectReason -Bad Vanity Url, test, , , http://, Home, http://{alias}/users/baduser, {defaultPage}?TabId={tabId}, 301, http://{alias}/, Deleted_Page -Vanity Url, test, , testuser, http://, Activity Feed, http://{alias}/users/{vanityUrl}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 -Vanity Url Messges, test, , testuser, http://, Messages, http://{alias}/users/{vanityUrl}/Messages, {defaultPage}?TabId={tabId}&UserId={userId}, 200 -Vanity Url Notification, test, , testuser, http://, Messages, http://{alias}/users/{vanityUrl}/Messages/view/notifications/action/notifications, {defaultPage}?TabId={tabId}&UserId={userId}&view=notifications&action=notifications, 200 -Vanity Url Profile, test, , testuser, http://, Activity Feed, http://{alias}/users/{vanityUrl}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 200 -Old Url No Vanity Url Default, test, , , http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 -Old Url Vanity Url Default, test, , testuser, http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}, Unfriendly_Url_2 -Old Url Vanity Url Messges Default, test, , testuser, http://, Messages, http://{alias}/Activity-Feed/Messages/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}/Messages, Unfriendly_Url_2 -Old Url Vanity Url Profile Default, test, , testuser, http://, Activity Feed, http://{alias}/Activity-Feed//UserId/{userId}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 301, http://{alias}/users/{vanityUrl}/ctl/Profile/pageno/1, Unfriendly_Url_2 -Old Url No Vanity Url false, test, false, , http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 -Old Url Vanity Url false, test, false, testuser, http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 -Old Url Vanity Url Messges false, test, false, testuser, http://, Messages, http://{alias}/Activity-Feed/Messages/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 -Old Url Vanity Url Profile false, test, false, testuser, http://, Activity Feed, http://{alias}/Activity-Feed//UserId/{userId}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 200 -Old Url No Vanity Url true, test, true, , http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 -Old Url Vanity Url true, test, true, testuser, http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}, Unfriendly_Url_2 -Old Url Vanity Url Messges true, test, true, testuser, http://, Messages, http://{alias}/Activity-Feed/Messages/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}/Messages, Unfriendly_Url_2 -Old Url Vanity Url Profile true, test, true, testuser, http://, Activity Feed, http://{alias}/Activity-Feed//UserId/{userId}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 301, http://{alias}/users/{vanityUrl}/ctl/Profile/pageno/1, Unfriendly_Url_2 \ No newline at end of file +Bad Vanity Url, test1, , , http://, Home, http://{alias}/users/baduser, {defaultPage}?TabId={tabId}, 301, http://{alias}/, Deleted_Page +Vanity Url, test1, , testuser, http://, Activity Feed, http://{alias}/users/{vanityUrl}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 +Vanity Url Messges, test1, , testuser, http://, Messages, http://{alias}/users/{vanityUrl}/Messages, {defaultPage}?TabId={tabId}&UserId={userId}, 200 +Vanity Url Notification, test1, , testuser, http://, Messages, http://{alias}/users/{vanityUrl}/Messages/view/notifications/action/notifications, {defaultPage}?TabId={tabId}&UserId={userId}&view=notifications&action=notifications, 200 +Vanity Url Profile, test1, , testuser, http://, Activity Feed, http://{alias}/users/{vanityUrl}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 200 +Old Url No Vanity Url Default, test1, , , http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 +Old Url Vanity Url Default, test1, , testuser, http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}, Unfriendly_Url_2 +Old Url Vanity Url Messges Default, test1, , testuser, http://, Messages, http://{alias}/Activity-Feed/Messages/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}/Messages, Unfriendly_Url_2 +Old Url Vanity Url Profile Default, test1, , testuser, http://, Activity Feed, http://{alias}/Activity-Feed//UserId/{userId}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 301, http://{alias}/users/{vanityUrl}/ctl/Profile/pageno/1, Unfriendly_Url_2 +Old Url No Vanity Url false, test1, false, , http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 +Old Url Vanity Url false, test1, false, testuser, http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 +Old Url Vanity Url Messges false, test1, false, testuser, http://, Messages, http://{alias}/Activity-Feed/Messages/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 +Old Url Vanity Url Profile false, test1, false, testuser, http://, Activity Feed, http://{alias}/Activity-Feed//UserId/{userId}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 200 +Old Url No Vanity Url true, test1, true, , http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 200 +Old Url Vanity Url true, test1, true, testuser, http://, Activity Feed, http://{alias}/Activity-Feed/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}, Unfriendly_Url_2 +Old Url Vanity Url Messges true, test1, true, testuser, http://, Messages, http://{alias}/Activity-Feed/Messages/UserId/{userId}, {defaultPage}?TabId={tabId}&UserId={userId}, 301, http://{alias}/users/{vanityUrl}/Messages, Unfriendly_Url_2 +Old Url Vanity Url Profile true, test1, true, testuser, http://, Activity Feed, http://{alias}/Activity-Feed//UserId/{userId}/ctl/Profile/pageno/1, {defaultPage}?TabId={tabId}&UserId={userId}&ctl=Profile&pageno=1, 301, http://{alias}/users/{vanityUrl}/ctl/Profile/pageno/1, Unfriendly_Url_2 \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Users.csv b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Users.csv index 7ae69d2dfbc..ff796c4bd64 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Users.csv +++ b/DNN Platform/Tests/DotNetNuke.Tests.Urls/TestFiles/Users.csv @@ -1,2 +1,2 @@ UserName, Password, VanityUrl -test, dnntest, testuser \ No newline at end of file +test1, dnntest, testuser \ No newline at end of file diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlRewriteTests.cs b/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlRewriteTests.cs index 77bc403d66a..5f90985955f 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlRewriteTests.cs +++ b/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlRewriteTests.cs @@ -294,7 +294,7 @@ private void ExecuteTestForTab(TabInfo tab, FriendlyUrlSettings settings, Dictio case 301: case 302: //Test for final Url if redirected - Assert.AreEqual(expectedRedirectUrl, testHelper.Result.FinalUrl.TrimStart('/')); + Assert.IsTrue(expectedRedirectUrl.Equals(testHelper.Result.FinalUrl.TrimStart('/'), StringComparison.InvariantCultureIgnoreCase)); Assert.AreEqual(redirectReason, testHelper.Result.Reason.ToString(), "Redirect reason incorrect"); break; } diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlTestBase.cs b/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlTestBase.cs index de87eb1f26c..8085d7b0768 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlTestBase.cs +++ b/DNN Platform/Tests/DotNetNuke.Tests.Urls/UrlTestBase.cs @@ -110,7 +110,7 @@ protected void SetDefaultAlias(string defaultAlias) { foreach (var alias in PortalAliasController.Instance.GetPortalAliasesByPortalId(PortalId)) { - if (alias.HTTPAlias == defaultAlias) + if (string.Equals(alias.HTTPAlias, defaultAlias, StringComparison.InvariantCultureIgnoreCase)) { alias.IsPrimary = true; PortalAliasController.Instance.UpdatePortalAlias(alias);