MENU

Support WebGIS

Need a push in the right direction when configuring WebMap, Portal or SDI services? Looking for hints and tips, or just looking for Ideas and information? The WebGIS discussion board is where you start those discussions, connect and share information.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 40
Registered: ‎08-10-2016
Accepted Solution

Geospatial Portal Forms Authentication timeout

Hi Everyone,

 

Am having a bit of a challenge with Forms Authentication in the Geospatial Portal. I need the portal to automatically redirect to the login page when the session times out. i.e when the portal remains idle for about 20 minutes.

 

The current  situation is that when there is a timeout the geospatial portal map window remains open but the maps do not reload when zooming in or out. I have to manually reload the whole portal so as to access the login page.

 

It would be nice to have it reload automatically and let the user user know their session/connection timed out. Is this possible without any custon code/scripts. But even if custom code is necessary, which file would i be looking at? Will i need to use the SDK for this?

 

 

Regards,

Elvon

Technical Evangelist
Posts: 452
Registered: ‎09-11-2015

Re: Geospatial Portal Forms Authentication timeout

Hi Elvon,

 

From the ASP.NET POV the session is invalid already but from the client side, it is driven mostly by JavaScript. I'm not sure if this could be altered by modifying the ASPX page header, likely not. But I can think of another solution. Use JavaScript/jQuery to watch the user activity, like this (source):

(function () {
   var idleTime = 0;
   $(document).ready(function () {
      //Increment the idle time counter every minute.
      var idleInterval = setInterval(timerIncrement, 60000); // 1 minute

      //Zero the idle timer on mouse movement.
      $(this).mousemove(function (e) {
         idleTime = 0;
      });
      $(this).keypress(function (e) {
         idleTime = 0;
      });
   });

   function timerIncrement() {
      idleTime++;
      if (idleTime > 19) { // 20 minutes
         window.location.replace("loginform.aspx");
      }
   }
})();

Create a JS file, e.g. Redirection.js, with that script inside <Portal_Instance>\js folder and reference it in all ASPX pages that you expect to be used with your portal (e.g. Full.aspx, ApolloPro.aspx, ...):

<asp:ScriptManager runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true">
   <Scripts>
      <asp:ScriptReference Path="js/MapConfig.js" />
      <asp:ScriptReference Path="js/LayoutHelper.js" />
      <asp:ScriptReference Path="js/API.min.js" />
      <asp:ScriptReference Path="js/StyleConfig.js" />
      <asp:ScriptReference Path="js/Redirection.js" />
   </Scripts>
</asp:ScriptManager>

Regards,

Jan

Jan Neumann
EMEA Presales Engineer
Hexagon Geospatial

Contributor
Posts: 40
Registered: ‎08-10-2016

Re: Geospatial Portal Forms Authentication timeout

Hi Jan,

 

Thanks, it worked. I also had to add reference for jquery as shown.

<asp:ScriptManager runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true">
        <Scripts>
            <asp:ScriptReference Path="js/MapConfig.js" />
            <asp:ScriptReference Path="js/LayoutHelper.js" />
            <asp:ScriptReference Path="js/API.min.js" />
            <asp:ScriptReference Path="js/StyleConfig.js" />
            <asp:ScriptReference Path="js/Scrollbar.js" /> 
	    <asp:ScriptReference Path="js/jquery.js" />
	<%--<asp:ScriptReference Path="js/CustomFeatureInfo.js" />--%>
	    <asp:ScriptReference Path="js/Redirection.js" />
        </Scripts>
    </asp:ScriptManager>

 

Regards,

Elvon

Technical Evangelist
Posts: 452
Registered: ‎09-11-2015

Re: Geospatial Portal Forms Authentication timeout

Ah, yeah, thanks for the correction. I also found pure JS version (on StackOverflow community) which doesn't need jQuery but for some reasons it didn't work well when I quickly tested it. So I settled with the jQuery.

 

Regards,

Jan

Jan Neumann
EMEA Presales Engineer
Hexagon Geospatial

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.