private void ShowOtherTips() { int count = this.m_MatchUrlAction.Count; if (count > 0) { for (int i = 0; i < count; i++) { UrlAction urlAction = this.m_MatchUrlAction[i]; if (urlAction != null) { urlAction.Execute(); } } } if (Singleton <GameStateCtrl> .instance.GetCurrentState() is LobbyState) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null && ActivitySys.NeedShowWhenLogin() && !MonoSingleton <NewbieGuideManager> .GetInstance().isNewbieGuiding) { ActivitySys.UpdateLoginShowCnt(); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Activity_OpenForm); } else { MonoSingleton <NobeSys> .GetInstance().ShowDelayNobeLoseTipsInfo(); MonoSingleton <PandroaSys> .GetInstance().ShowPopNews(); } } }
private UrlRewritingResult TestUrlRewritingInternal(string uriString) { var rewritingResult = new UrlRewritingResult(); try { var noneText = Localization.GetString("None", Localization.GlobalResourceFile); var uri = new Uri(uriString); var provider = new AdvancedUrlRewriter(); var result = new UrlAction(uri.Scheme, uriString, Globals.ApplicationMapPath) { RawUrl = uriString }; var httpContext = new HttpContext(HttpContext.Current.Request, new HttpResponse(new StringWriter())); provider.ProcessTestRequestWithContext(httpContext, uri, true, result, new FriendlyUrlSettings(this.PortalId)); rewritingResult.RewritingResult = string.IsNullOrEmpty(result.RewritePath) ? noneText : result.RewritePath; rewritingResult.Culture = string.IsNullOrEmpty(result.CultureCode) ? noneText : result.CultureCode; var tab = TabController.Instance.GetTab(result.TabId, result.PortalId, false); rewritingResult.IdentifiedPage = (tab != null ? tab.TabName : noneText); rewritingResult.RedirectionReason = Localization.GetString(result.Reason.ToString()); rewritingResult.RedirectionResult = result.FinalUrl; var messages = new StringBuilder(); foreach (var message in result.DebugMessages) { messages.AppendLine(message); } rewritingResult.OperationMessages = messages.ToString(); } catch (Exception ex) { rewritingResult.OperationMessages = ex.Message; } return(rewritingResult); }
public byte[] GetZoneActionPolicy(UrlZone zone, UrlAction action, UrlZoneReg zoneReg) { IntPtr pPolicy = Marshal.AllocHGlobal(8196); try { if (this.izm.GetZoneActionPolicy((uint)zone, (uint)action, pPolicy, 8196, (uint)zoneReg) == 0) { byte[] buff = new byte[8196]; for (int i = 0; i < buff.Length; i++) { buff[i] = Marshal.ReadByte(pPolicy, i); } return(buff); } throw new Exception(); } finally { Marshal.FreeHGlobal(pPolicy); } }
private static bool IsRedirectAllowed(string url, HttpApplication app, PortalSettings portalSettings) { var urlAction = new UrlAction(app.Request); urlAction.SetRedirectAllowed(url, new FriendlyUrlSettings(portalSettings.PortalId)); return(urlAction.RedirectAllowed); }
private static void AddActionToView(List <string> entities, AppDbContext context) { var actions = new List <UrlAction>(); foreach (var entity in entities) { var role = new UrlAction { Name = entity }; actions.Add(role); } var allRole = context.UrlActions.Where(c => c.Deleted == false); foreach (var role in actions) { var hasInRole = allRole.FirstOrDefault(c => c.Name == role.Name); if (hasInRole != null) { continue; } context.UrlActions.Add(role); context.SaveChanges(); } }
public IISUrlRewriteRule(string name, UrlMatch initialMatch, ConditionCollection conditions, UrlAction action) : this(name, initialMatch, conditions, action, false) { }
public void AddUrlAction(UrlAction action) { if (action == null) { throw new ArgumentNullException(nameof(action), "Rules must contain an action"); } _action = action; }
public string GetUrl() { if (UrlAction != null) { return(UrlAction.Invoke(this)); } return(BaseUrl); }
public void TestUrlActionEquality() { UrlAction action1 = UrlAction.Create("action 1"); UrlAction action2 = UrlAction.Create("ACTION 1"); UrlAction action3 = UrlAction.Create("action 3"); Assert.IsTrue(action1.Equals(action2)); Assert.IsFalse(action1.Equals(action3)); Assert.IsFalse(action1.Equals(null)); }
public IISUrlRewriteRule(string name, UrlMatch initialMatch, ConditionCollection conditions, UrlAction action, bool global) { Name = name; InitialMatch = initialMatch; Conditions = conditions; Action = action; Global = global; }
public static void UrlAction() { Document document = new Document(); Page page = new Page(); document.Pages.Add(page); UrlAction action = new UrlAction("http://www.mydomain.com"); Link link = new Link(50, 50, Font.Helvetica.GetTextWidth("My Domain", 18), 20, action); page.Elements.Add(link); document.Draw(Util.GetPath("Output/UrlAction.pdf")); }
public void OnOpenForm(ApolloNoticeInfo noticeInfo, NoticeSys.NOTICE_STATE noticeState) { this.m_CurState = noticeState; this.m_NoticeDataList = new ListView <NoticeSys.NoticeDataEx>(); this.m_MatchUrlAction.Clear(); ListView <NoticeSys.NoticeDataEx> listView = new ListView <NoticeSys.NoticeDataEx>(); int count = noticeInfo.DataList.get_Count(); for (int i = 0; i < count; i++) { ApolloNoticeData apolloNoticeData = noticeInfo.DataList.get_Item(i); if (apolloNoticeData.MsgType == APOLLO_NOTICETYPE.APO_NOTICETYPE_ALERT) { ListView <UrlAction> listView2 = UrlAction.ParseFromText(apolloNoticeData.ContentUrl, null); if (listView2.Count > 0 && listView2[0].action == UrlAction.Action.openMatchUrl) { this.m_MatchUrlAction.Add(listView2[0]); } else { NoticeSys.NoticeDataEx noticeDataEx = new NoticeSys.NoticeDataEx(); noticeDataEx.apolloNoticeData = apolloNoticeData; if (noticeState == NoticeSys.NOTICE_STATE.LOGIN_After) { if (apolloNoticeData.ContentType == APOLLO_NOTICE_CONTENTTYPE.APO_CONTENTTYPE_WEB && this.IsImageNotice(ref noticeDataEx)) { listView.Add(noticeDataEx); } else { this.m_NoticeDataList.Add(noticeDataEx); } } else { this.m_NoticeDataList.Add(noticeDataEx); } } } } this.InitImageShowTimes(); this.FiterImageNotice(listView); if (this.m_NoticeDataList.Count > 0) { this.ShowNoticeWindow(0); } else if (this.m_CurState == NoticeSys.NOTICE_STATE.LOGIN_After) { this.ShowOtherTips(); } }
public static PortalAliasInfo GetAliasByPortalIdAndSettings(this IEnumerable <PortalAliasInfo> aliases, int portalId, string requestedAlias, string cultureCode, FriendlyUrlSettings settings) { var browserType = BrowserTypes.Normal; UrlAction result = null; //if required, and possible, detect browser type if (HttpContext.Current != null && settings != null) { HttpRequest request = HttpContext.Current.Request; HttpResponse response = HttpContext.Current.Response; browserType = FriendlyUrlController.GetBrowserType(request, response, settings); result = new UrlAction(HttpContext.Current.Request) { IsSecureConnection = request.IsSecureConnection, RawUrl = request.RawUrl, HttpAlias = requestedAlias, }; } return(GetAliasByPortalIdAndSettings(aliases, portalId, result, cultureCode, browserType)); }
private void ProcessShowNoticeWindown(ApolloNoticeData noticeData) { this.m_bGoto = false; this.m_bLoadImage = false; string msgID = noticeData.MsgID; string openID = noticeData.OpenID; string text = noticeData.MsgUrl; ListView <UrlAction> listView = UrlAction.ParseFromText(noticeData.ContentUrl, null); if (listView.Count > 0) { this.m_urlAction = listView[0]; } else { this.m_urlAction = null; } if (text == null) { text = string.Empty; } APOLLO_NOTICETYPE msgType = noticeData.MsgType; string startTime = noticeData.StartTime; APOLLO_NOTICE_CONTENTTYPE contentType = noticeData.ContentType; string msgTitle = noticeData.MsgTitle; string msgContent = noticeData.MsgContent; NoticeSys.PrintLog(string.Concat(new object[] { " msgID ", noticeData.MsgID, " MsgUrl", text, "msgtitle = ", msgTitle, " content ", msgContent, " openid= ", openID, " MsgType = ", msgType, " contenturl =", noticeData.ContentUrl })); uint num = 0u; if (this.m_CurState == NoticeSys.NOTICE_STATE.LOGIN_After) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { num = masterRoleInfo.PvpLevel; } } else { num = 0u; } this.m_btnUrl = string.Empty; this.m_btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE; if (msgType == APOLLO_NOTICETYPE.APO_NOTICETYPE_ALERT) { bool flag = false; bool flag2 = this.CheckIsBtnUrl(text, ref flag, ref this.m_ImageModleTitle, ref this.m_btnDoSth, ref this.m_btnUrl); if (flag2) { if (flag) { bool flag3 = false; flag2 = this.CheckIsBtnUrl("#" + this.m_btnUrl + "&end", ref flag3, ref this.m_ImageModleTitle, ref this.m_btnDoSth, ref this.m_btnUrl); } if (this.m_btnDoSth == NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NOTSHOW && this.m_btnUrl != MonoSingleton <TdirMgr> .GetInstance().SelectedTdir.logicWorldID.ToString()) { NoticeSys.PrintLog("noticesys not show " + this.m_btnUrl); return; } NoticeSys.PrintLog("find url " + this.m_btnUrl + " ori = " + text); } else { NoticeSys.PrintLog("find url ori = " + text); } if (this.m_CurState == NoticeSys.NOTICE_STATE.LOGIN_After && num <= 5u) { this.m_btnDoSth = NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE; this.m_btnUrl = string.Empty; } if (this.m_Form == null) { this.m_Form = Singleton <CUIManager> .GetInstance().OpenForm(NoticeSys.s_formNoticeLoginPath, false, true); } Transform transform = this.m_Form.gameObject.transform.Find("Panel/BtnGroup/Button_Complte"); if (this.m_btnUrl != string.Empty && this.m_btnDoSth != NoticeSys.BTN_DOSOMTHING.BTN_DOSOMTHING_NONE) { this.m_bGoto = true; } else { this.m_bGoto = false; } this.m_bShow = true; this.m_TextContent = Utility.GetComponetInChild <Text>(this.m_Form.gameObject, "Panel/ScrollRect/Content/Text"); this.m_ImageContent = Utility.GetComponetInChild <Image>(this.m_Form.gameObject, "Panel/Image"); this.m_ImageDefault = Utility.GetComponetInChild <Image>(this.m_Form.gameObject, "Panel/ImageDefalut"); this.m_Title = Utility.GetComponetInChild <Text>(this.m_Form.gameObject, "Panel/GameObject/Title/ContentTitle"); this.m_TitleBoard = this.m_Form.gameObject.transform.Find("Panel/GameObject/Title").gameObject; this.m_TextContent.gameObject.CustomSetActive(false); this.m_ImageContent.gameObject.CustomSetActive(false); if (this.m_ImageDefault) { this.m_ImageDefault.gameObject.CustomSetActive(false); } this.m_Title.set_text(msgTitle); if (contentType != APOLLO_NOTICE_CONTENTTYPE.APO_CONTENTTYPE_IMAGE) { if (contentType == APOLLO_NOTICE_CONTENTTYPE.APO_SCONTENTTYPE_TEXT) { this.m_TextContent.gameObject.CustomSetActive(true); this.m_TextContent.set_text(msgContent); this.m_TitleBoard.CustomSetActive(true); RectTransform component = this.m_TextContent.transform.parent.gameObject.GetComponent <RectTransform>(); if (component) { component.sizeDelta = new Vector2(0f, this.m_TextContent.get_preferredHeight() + 50f); } } else if (contentType == APOLLO_NOTICE_CONTENTTYPE.APO_CONTENTTYPE_WEB && this.m_urlAction != null) { this.m_bShow = true; this.m_TitleBoard.CustomSetActive(true); this.m_Title.set_text(this.m_ImageModleTitle); if (this.m_ImageDefault) { this.m_ImageDefault.gameObject.CustomSetActive(true); } this.m_ImageContent.gameObject.CustomSetActive(false); base.StartCoroutine(MonoSingleton <IDIPSys> .GetInstance().DownloadImage(this.m_urlAction.target, delegate(Texture2D text2) { if (this.m_bShow && this.m_ImageContent != null) { this.m_ImageContent.gameObject.CustomSetActive(true); if (this.m_ImageDefault) { this.m_ImageDefault.gameObject.CustomSetActive(false); } this.m_bLoadImage = true; this.m_ImageContent.SetSprite(Sprite.Create(text2, new Rect(0f, 0f, (float)text2.width, (float)text2.height), new Vector2(0.5f, 0.5f)), ImageAlphaTexLayout.None); BugLocateLogSys.Log("noticesysy contenturl " + this.m_urlAction.target); } }, 0)); } } } }
public void TestUrlActionWithNullCtorParameter() { UrlAction.Create(null); }
public static PortalAliasInfo GetAliasByPortalIdAndSettings(this IEnumerable <PortalAliasInfo> aliases, UrlAction result) { return(GetAliasByPortalIdAndSettings(aliases, result.PortalId, result, result.CultureCode, result.BrowserType)); }
/// <summary> /// Returns a ChosenPortalAlias object where the portalId, culture code and isMobile matches /// </summary> /// <param name="aliases"></param> /// <param name="portalId"></param> /// <param name="result"></param> /// <param name="cultureCode"></param> /// <param name="browserType"></param> /// <returns>A ChosenPOrtalAlias</returns> /// <remarks>Note will return a best-match by portal if no specific culture Code match found</remarks> public static PortalAliasInfo GetAliasByPortalIdAndSettings(this IEnumerable <PortalAliasInfo> aliases, int portalId, UrlAction result, string cultureCode, BrowserTypes browserType) { var aliasList = aliases.ToList(); //First check if our current alias is already a perfect match. PortalAliasInfo foundAlias = null; if (result != null && !string.IsNullOrEmpty(result.HttpAlias)) { //try to find exact match foundAlias = aliasList.FirstOrDefault(a => a.BrowserType == browserType && (String.Compare(a.CultureCode, cultureCode, StringComparison.OrdinalIgnoreCase) == 0) && a.PortalID == portalId && a.HTTPAlias == result.HttpAlias); if (foundAlias == null) //let us try again using Startswith() to find matching Hosts { foundAlias = aliasList.FirstOrDefault(a => a.BrowserType == browserType && (String.Compare(a.CultureCode, cultureCode, StringComparison.OrdinalIgnoreCase) == 0) && a.PortalID == portalId && a.HTTPAlias.StartsWith(result.HttpAlias.Split('/')[0])); } } //27138 : Redirect loop caused by duplicate primary aliases. Changed to only check by browserType/Culture code which makes a primary alias if (foundAlias == null) { foundAlias = aliasList.Where(a => a.BrowserType == browserType && (String.Compare(a.CultureCode, cultureCode, StringComparison.OrdinalIgnoreCase) == 0 || String.IsNullOrEmpty(a.CultureCode)) && a.PortalID == portalId) .OrderByDescending(a => a.IsPrimary) .ThenByDescending(a => a.CultureCode) .FirstOrDefault(); } //JIRA DNN-4882 : DevPCI fix bug with url Mobile -> Search alias with culture code // START DNN-4882 if (foundAlias == null) { foundAlias = aliasList.Where(a => (String.Compare(a.CultureCode, cultureCode, StringComparison.OrdinalIgnoreCase) == 0 || String.IsNullOrEmpty(a.CultureCode)) && a.PortalID == portalId) .OrderByDescending(a => a.IsPrimary) .ThenByDescending(a => a.CultureCode) .FirstOrDefault(); } // END DNN-4882 if (foundAlias != null) { if (result != null && result.PortalAlias != null) { if (foundAlias.BrowserType != result.PortalAlias.BrowserType) { result.Reason = foundAlias.CultureCode != result.PortalAlias.CultureCode ? RedirectReason.Wrong_Portal_Alias_For_Culture_And_Browser : RedirectReason.Wrong_Portal_Alias_For_Browser_Type; } else { if (foundAlias.CultureCode != result.PortalAlias.CultureCode) { result.Reason = RedirectReason.Wrong_Portal_Alias_For_Culture; } } } } else { // if we didn't find a specific match, return the default, which is the closest match var defaultAlias = aliasList .Where(a => a.PortalID == portalId) .OrderByDescending(a => a.IsPrimary) .FirstOrDefault(); foundAlias = defaultAlias; } return(foundAlias); }
/// <summary> /// Initializes a new instance of the <see cref="NexusUrl" /> class. /// </summary> public NexusUrl(UrlAction action, IUrlAction data) { Action = action; Data = data; }
public ShortUrlAzureTableCommand(SubjectUrlForAzureTable url, UrlAction urlAction) { this.url = url; this.urlAction = urlAction; }
public void TestUrlActionWithEmptyCtorParameter() { UrlAction.Create(""); }
/// <summary> /// Returns a ChosenPortalAlias object where the portalId, culture code and isMobile matches /// </summary> /// <param name="aliases"></param> /// <param name="portalId"></param> /// <param name="result"></param> /// <param name="cultureCode"></param> /// <param name="browserType"></param> /// <returns>A ChosenPOrtalAlias</returns> /// <remarks>Note will return a best-match by portal if no specific culture Code match found</remarks> public static PortalAliasInfo GetAliasByPortalIdAndSettings(this IEnumerable <PortalAliasInfo> aliases, int portalId, UrlAction result, string cultureCode, BrowserTypes browserType) { var aliasList = aliases.ToList(); var defaultAlias = aliasList.ToList().Where(a => a.PortalID == portalId) .OrderByDescending(a => a.IsPrimary) .FirstOrDefault(); //27138 : Redirect loop caused by duplicate primary aliases. Changed to only check by browserType/Culture code which makes a primary alias var foundAlias = aliasList.Where(a => a.BrowserType == browserType && (String.Compare(a.CultureCode, cultureCode, StringComparison.OrdinalIgnoreCase) == 0 || String.IsNullOrEmpty(a.CultureCode)) && a.PortalID == portalId) .OrderByDescending(a => a.IsPrimary) .ThenByDescending(a => a.CultureCode) .FirstOrDefault(); if (foundAlias != null) { if (result != null && result.PortalAlias != null) { if (foundAlias.BrowserType != result.PortalAlias.BrowserType) { result.Reason = foundAlias.CultureCode != result.PortalAlias.CultureCode ? RedirectReason.Wrong_Portal_Alias_For_Culture_And_Browser : RedirectReason.Wrong_Portal_Alias_For_Browser_Type; } else { if (foundAlias.CultureCode != result.PortalAlias.CultureCode) { result.Reason = RedirectReason.Wrong_Portal_Alias_For_Culture; } } } } else { foundAlias = defaultAlias; } //if we didn't find a specific match, return the default, which is the closest match return(foundAlias); }
public void TestUrlActionWithNullCtorParameter() { Assert.ThrowsException <ArgumentNullException>(() => UrlAction.Create(null)); }
public void TestUrlActionWithWhiteSpaceCtorParameter() { Assert.ThrowsException <ArgumentException>(() => UrlAction.Create(" ")); }
public void CheckForRedirects_WithUmlautUrls_DontRedirectInfinitely() { // Arrange const string CheckForRedirectsMethodName = "CheckForRedirects"; const string HostSettingsTableName = "HostSettings"; const string PortalSettingsTableName = "PortalSettings"; const string LanguagesTableName = "Languages"; const string TabsTableName = "Tabs"; const string TabUrlsTableName = "TabUrls"; const string PortalsTableName = "Portals"; const string TabSettingsTableName = "TabSettings"; const string PortalAliasTableName = "PortalAlias"; const string ExtensionUrlProviderTableName = "ExtensionUrlProvider"; const string HttpScheme = "http"; const string HttpsScheme = "https"; const string UriUrl = HttpScheme + "://" + GenericHost + "/über-uns/ctl/module/moduleid/466?returnurl=/über-uns"; const string FullUrl = HttpScheme + "://" + GenericHost + "/%C3%BCber-uns/ctl/module/moduleid/466?returnurl=/%C3%BCber-uns"; const string RewritePath = "Default.aspx?TabId=1&ctl=module&moduleid=466&returnurl=/%C3%BCber-uns&language=en-US"; const string SampleHttpsUrl = HttpsScheme + "://google.com"; const string PortalSettingsControllerRegistrationName = "PortalSettingsController"; const string DNNPlatformText = "DNN Platform"; const string WebsiteText = "Website"; const string ApplicationPath = "/"; const string UrlRewriteItemName = "UrlRewrite:OriginalUrl"; ComponentFactory.Container = null; PortalController.ClearInstance(); Host.PerformanceSetting = Globals.PerformanceSettings.ModerateCaching; var uri = new Uri(Assembly.GetExecutingAssembly().CodeBase); var path = HttpUtility.UrlDecode(Path.GetFullPath(uri.AbsolutePath)); var websiteRootPath = path.Substring(0, path.IndexOf(DNNPlatformText, StringComparison.Ordinal)); var physicalAppPath = Path.Combine(websiteRootPath, WebsiteText); var simulator = new HttpSimulator(ApplicationPath, physicalAppPath); simulator.SimulateRequest(new Uri(SampleHttpsUrl)); HttpContext.Current.Items.Add(UrlRewriteItemName, FullUrl); var serviceCollection = new ServiceCollection(); serviceCollection.AddTransient(container => Mock.Of <IHostSettingsService>()); serviceCollection.AddTransient(container => Mock.Of <IApplicationStatusInfo>()); serviceCollection.AddTransient(container => Mock.Of <INavigationManager>()); serviceCollection.AddTransient(container => Mock.Of <IPortalAliasService>()); MockComponentProvider.CreateNew <CachingProvider>(); MockComponentProvider.CreateNew <DataProvider>(); MockComponentProvider.CreateNew <LoggingProvider>(); MockComponentProvider.CreateNew <PortalSettingsController>(PortalSettingsControllerRegistrationName); var dataProvider = MockComponentProvider.CreateDataProvider(); var hostSettingsTable = new DataTable(HostSettingsTableName); dataProvider .Setup(s => s.GetHostSettings()) .Returns(() => hostSettingsTable.CreateDataReader()); var portalSettingsTable = new DataTable(PortalSettingsTableName); dataProvider .Setup(s => s.GetPortalSettings( It.IsAny <int>(), It.IsAny <string>())) .Returns(() => portalSettingsTable.CreateDataReader()); var languagesTable = new DataTable(LanguagesTableName); dataProvider .Setup(s => s.GetLanguagesByPortal(It.IsAny <int>())) .Returns(() => languagesTable.CreateDataReader()); var tabsTable = new DataTable(TabsTableName); FillTabsTable(tabsTable); dataProvider .Setup(s => s.GetTabs(It.IsAny <int>())) .Returns(() => tabsTable.CreateDataReader()); dataProvider .Setup(s => s.GetTabCustomAliases(It.IsAny <int>())) .Returns(() => tabsTable.CreateDataReader()); var tabUrlsTable = new DataTable(TabUrlsTableName); dataProvider .Setup(s => s.GetTabPaths( It.IsAny <int>(), It.IsAny <string>())) .Returns(() => tabUrlsTable.CreateDataReader()); dataProvider .Setup(s => s.GetTabUrls(It.IsAny <int>())) .Returns(() => tabUrlsTable.CreateDataReader()); var tabSettingsTable = new DataTable(TabSettingsTableName); dataProvider .Setup(s => s.GetTabSettings(It.IsAny <int>())) .Returns(() => tabSettingsTable.CreateDataReader()); var portalsTable = new DataTable(PortalsTableName); FillPortalsTable(portalsTable); dataProvider .Setup(s => s.GetPortals(It.IsAny <string>())) .Returns(() => portalsTable.CreateDataReader()); var extensionUrlProviderTable = new DataTable(ExtensionUrlProviderTableName); dataProvider .Setup(s => s.GetExtensionUrlProviders(It.IsAny <int>())) .Returns(() => extensionUrlProviderTable.CreateDataReader()); var portalAliasTable = new DataTable(PortalAliasTableName); FillPortalAliasTable(portalAliasTable); dataProvider .Setup(s => s.GetPortalAliases()) .Returns(() => portalAliasTable.CreateDataReader()); Globals.DependencyProvider = serviceCollection.BuildServiceProvider(); var urlRewriter = new AdvancedUrlRewriter(); var checkForRedirectsMethod = typeof(AdvancedUrlRewriter) .GetMethod( CheckForRedirectsMethodName, BindingFlags.Static | BindingFlags.NonPublic); var requestUri = new Uri(UriUrl); var queryStringCollection = new NameValueCollection(); var friendlyUrlSettings = new FriendlyUrlSettings(GenericPortalId); var urlAction = new UrlAction( HttpScheme, string.Empty, string.Empty) { TabId = GenericTabId, Action = ActionType.CheckFor301, PortalId = GenericPortalId, IsSSLOffloaded = true, PortalAlias = new PortalAliasInfo { HTTPAlias = GenericHost, }, DoRewrite = true, RewritePath = RewritePath }; urlAction.SetRedirectAllowed(string.Empty, friendlyUrlSettings); var requestType = string.Empty; var portalHomeTabId = GenericTabId; // Act var isRedirected = checkForRedirectsMethod.Invoke( urlRewriter, new object[] { requestUri, FullUrl, queryStringCollection, urlAction, requestType, friendlyUrlSettings, portalHomeTabId }); // Assert Assert.AreEqual(false, isRedirected); }
public void TestUrlActionWithWhiteSpaceCtorParameter() { UrlAction.Create(" "); }