wet-boew/cdts-DotNetTemplates

Configuring WebTemplateModel.Settings.LeavingSecureSiteWarning

Closed this issue · 4 comments

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

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.

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.

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

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