wet-boew / cdts-DotNetTemplates

Documentation for CDTS
9 stars 2 forks source link

Configuring WebTemplateModel.Settings.LeavingSecureSiteWarning #60

Closed sgdowney closed 1 year ago

sgdowney commented 1 year ago

When setting WebTemplateModel.Settings.LeavingSecureSiteWarning.DisplayModalWindow = true to use the popup dialogue, are you supposed to still configure the WebTemplateModel.Settings.LeavingSecureSiteWarning.RedirectUrl? Based on the documentation for the Exit Script, you either display the modal or use an intermediate page via WebTemplateModel.Settings.LeavingSecureSiteWarning.RedirectUrl.

When I enable the modal dialogue and don't set the RedirectUrl, the modal does not display and the browser navigates to the external Url. The modal dialogue will only display if I set the RedirectUrl property as well.

Version: GoC.WebTemplate Version MVC 2.0.8719.39537 GoC.WebTemplate.Core Version 2.0.8719.39446

Nuget package version: 4.0.0

ahmad-shahid commented 1 year ago

Yes, if DisplayModalWindow is true then you should see the popup and you don't need the RedirectUrl.

In order to investigate this, can you take a screenshot of the code where you set the LeavingSecureSiteWarning? Also, can you send me a screenshot of the web.config (specifically the GoC.WebTemplate node)?

Thanks.

sgdowney commented 1 year ago

Here is the web.config

  <GoC.WebTemplate version="v5_0_0" environment="Akamai" loadJQueryFromGoogle="false" showPreContent="true" showPostContent="true" showFeedbackLink="false" feedbackLinkUrl="" showLanguageLink="false" showSharePageLink="false" showSearch="false" sriEnabled="true" staticFilesLocation="~\Views\GoC.WebTemplate\StaticFallbackFiles" xmlns="http://tempuri.org/WebTemplateMVC.xsd">
    <sessionTimeOut enabled="true" inactivity="720000" reactionTime="180000" sessionAlive="750000" logoutUrl="#" refreshCallBackUrl="#" refreshOnClick="true" refreshLimit="120000" method="GET" additionalData="" />
    <leavingSecureSiteWarning enabled="true" displayModalWindow="true" redirectURL="" excludedDomains="" />
  </GoC.WebTemplate>

Here is the code from the Base controller that all controllers inherit from.

        WebTemplateModel.Settings.LeavingSecureSiteWarning.Message = MessageManager.GetText(exitMessageCode)

        If exitMessageCode = 3279 Then
            WebTemplateModel.Settings.LeavingSecureSiteWarning.RedirectUrl = Url.RouteUrl("ExitHangUp")
            WebTemplateModel.HTMLBodyElements.Add($"<script>var exitApi = ""{Url.HttpRouteUrl("DefaultApi", New With {.controller = "SessionExit", .id = PageContext.SessionId, .sendHangUp = True, .tcc = 9990})}""</script>")
        Else
            WebTemplateModel.HTMLBodyElements.Add($"<script>var exitApi = ""{Url.HttpRouteUrl("DefaultApi", New With {.controller = "SessionExit", .id = PageContext.SessionId, .sendHangUp = False, .tcc = 0})}""</script>")
            WebTemplateModel.Settings.LeavingSecureSiteWarning.RedirectUrl = Url.RouteUrl("ExitNoHangUp")
        End If

If I comment out the lines that set the RedirectUrl, the popup does not display and the browser navigates to the link that was clicked on. If I set the RedirectUrl property then the popup does display, and clicking Yes on the popup navigates to the link that was clicked.

ahmad-shahid commented 1 year ago

I was able to reproduce the issue. I'm investigating.

ahmad-shahid commented 1 year ago

There will be a new package v4.0.1 with this fix. I'll be released by afternoon.