Jump to content

invalid session or session timeout default page


donlego

Recommended Posts

  • 1 month later...
19 minutes ago, Sherzod said:

Sorry, it’s not very clear to me what you are asking.

Please make a simple testcase by specifying what should work and how?

step :

1. on the browser url type  localhost:8077/?cust_id=1000

2. try move the form until the session timeout (+-1 second)

3. click the restart application link

the url i want back like first 1 opened the url

localhost:8077/?cust_id=1000

when user clikc restart application

 

session.rar

Link to comment
Share on other sites

  • 1 month later...
17 minutes ago, andyhill said:

I have found that StandAlone MOBILE webapps do not honour ServerModule timings so as a work around I catch the MainModule Session TimeOut Event and extend it by 3 minutes (forever). 

i still need  session expire / timeout ,

my app limiting the user count acces , so if the user session never expire it can be problem to other user who want to login to the app

Link to comment
Share on other sites

  • 3 years later...
49 minutes ago, PS1 said:

Hey, any progress in finding the solution ?

I need to be able to refresh page after timeout with params : http://localhost:8078/?GUID=6

but it is not always ,,GUID=6"

Hello, I make solution my own.

here is it:

I use replace URL when user connect and remove some parameters from URL.

You try to use this to replace some params when restart session (or use cookies)

UniMainModule.CommandLine := TStringList.Create;
UniMainModule.CommandLine.StrictDelimiter := True;
for i:= 0 to UniApplication.Parameters.Count - 1 do begin
 try
   UniMainModule.CommandLine.Add (UniApplication.Parameters [I]);
 except

 end;
end;
 

  //read full URL 
    newURL := UniSession.ARequest.Referer;
    newURL := StringReplace (newURL,'&user=' + UniMainModule.CommandLine.Values ['user'],'',[rfReplaceAll]);
    newURL := StringReplace (newURL,'someotherparams=' + UniMainModule.CommandLine.Values ['someotherparams'],'',[rfReplaceAll]);
 

    //clear browser data
    UniSession.AddJS(
            // Current URL: UniSession.ARequest.Referer
            'const nextURL = ''' + newURL + ''';'
            + 'const nextTitle = ''' + UniServerModule.Title + ''';'
            + 'const nextState = { additionalInformation: ''Updated'' };'
            // This will create a new entry in the browser's history, without reloading
            + 'window.history.pushState(nextState, nextTitle, nextURL);'
            // This will replace the current entry in the browser's history, without reloading
            + 'window.history.replaceState(nextState, nextTitle, nextURL);'
            );

    UniSession.ARequest.Referer := newURL;
 

Try it !

here is my replacement of 

ServerMessages.ExceptionTemplate, InvalidSessionTemplate, TerminateTemplate

urlMessage := '<html>'
              + '<style>'
              //first style
              //+ '.button {'
              //+ '  border: none;'
              //+ '  color: white;'
              //+ '  padding: 16px 32px;'
              //+ '  text-align: center;'
              //+ '  text-decoration: none;'
              //+ '  display: inline-block;'
              //+ '  font-size: 16px;'
              //+ '  margin: 4px 2px;'
              //+ '  transition-duration: 0.4s;'
              //+ '  cursor: pointer;'
              //+ '  border-radius: 12px;'
              //+ '  box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);'
              //+ '  margin: 0;'
              //+ '  position: absolute;'
              //+ '  top: 10%;'
              //+ '  left: 50%;'
              //+ '  -ms-transform: translate(-50%, -50%);'
              //+ '  transform: translate(-50%, -50%);'
              //+ '}'
              //+ '.button1 {'
              //+ '  background-color: white;'
              //+ '  color: black;'
              ////+ '  border: 2px solid #4CAF50;'
              //+ '}'
              //+ '.button1:hover {'
              //+ '  background-color: #4CAF50;'
              //+ '  color: white;'
              //+ '}'
              //like click
              //+ '.button1:active {'
              //+ '  background-color: #3e8e41;'
              //+ '  box-shadow: 0 5px #666;'
              //+ '  transform: translateY(4px);'
              //+ '}'
              //second style
              + '.button {'
              + '  font-size: 16px;'
              + '  margin: 4px 2px;'
              //+ '  transition-duration: 0.4s;'
              + '  text-align: center;'
              + '  text-decoration: none;'
              + '  display: inline-block;'
              + '  padding: 16px 32px;'
              + '  text-align: center;'
              + '  position: absolute;'
              + '  cursor: pointer;'
              + '  outline: none;'
              + '  color: #fff;'
              + '  background-color: #04AA6D;'
              + '  border: none;'
              + '  border-radius: 15px;'
              + '  box-shadow: 0 9px #999;'
              + '  top: 10%;'
              + '  left: 43%;'
              //+ '  -ms-transform: translate(-50%, -50%);'
              //+ '  transform: translate(-50%, -50%);'
              + '}'
              + '.button:hover {background-color: #3e8e41}'
              + '.button:active {'
              + '  -webkit-animation:anim-effect-c 2s;'// forwards;'
              + '  color: red;'
//              + '  background-color: #3e8e41;'
              + '  background-color: yellow;'
              + '  box-shadow: 0 5px #666;'
              + '  transform: translateY(4px);'
              + ' }'//:active
//              + '.button::after {'
//              + '  -webkit-animation:anim-effect-c 2s forwards;'
//              + '  background-color: red;'
//              + '  -webkit-transform:scale3d(0.3,0.3,1);'
//              + '}'//:after
              + '@-webkit-keyframes anim-effect-c {'
              + '  0% {'
              + '    opacity:1;'
              + '    -webkit-transform:scale3d(0.5,0.5,1);'
              + '  }'
              + '  15% {'
              + '    opacity:1;'
              + '    -webkit-transform:scale3d(1.5,1.5,1);'
              + '  }'
              + '  30% {'
              + '    opacity:1;'
              + '    background-color: red;'
              + '    color: green;'
              + '    -webkit-transform:scale3d(2,2,1);'
              + '  }'
              + '  50% {'
              + '    opacity:0;'
              + '    background-color: blue;'
              + '    color: red;'
              + '    -webkit-transform:scale3d(0.3,0.3,1);'
              + '  }'
              + '  100% {'
              + '    opacity:0;'
              + '    background-color: #3e8e41;'
              + '    -webkit-transform:scale3d(1,1,1);'
              + '  }'
              + '}'//@-webkit-keyframes anim-effect-c
              + '</style>'
              //reload page
              + '<script>'
              + 'function redirect() {'
              //remove hash from url, else block and have problem
              + '  var url = window.location.href;'
              + '  var hash = window.location.hash' + 'endss' + ';'
              + '  var index_of_hash = url.indexOf(hash) || url.length;'
              + '  var hashless_url = url.substr(0, index_of_hash);'
              //+ '      alert (hashless_url);'
              + '  location.href = hashless_url;'
              //clear url 
              //+ 'location.href = window.location.href;'
              //replace hash
              //+ 'location.href.replace(location.hash,"");'
              + '}'
              + '</script>'
              + '<body bgcolor="#dfe8f6">'
              + '<p style="text-align:center;color:#0000A0">[###message###]</p>'
              + '<button class="button button1" type="button" onclick=redirect()>Restart application</button>'
              + '</body>'
              + '</html>

ServerMessages.ExceptionTemplate.Text := urlMessage;
ServerMessages.InvalidSessionTemplate.Text := urlMessage;
ServerMessages.TerminateTemplate.Text := urlMessage;
 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...