Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TerminateAndRedirect
#1
I have a main form and a second form.
I have a button on the second form to terminate session/app.

I open main than with a button click, I open my second form. On that form a hit a button that calls WebApplication.TerminateAndRedirect('some page')

Why is that instead of terminate and redirect to the specified page, the app return to the main form?
Reply
#2
When I call WebApplication.TerminateAndRedirect('some page') from that 2nd page, it sends to eventlogger the following error:

------------------------------------------------------------------------------------------------------------------------
Exception message : Your session has expired due to inactivity.
Your session has expired. You will have to restart the application. In order to keep sessions from expiring you may set the session timeout parameter to a higher value. The current session timeout value is 20 minutes.
Exception class : EExpiredSession
Session ID : Vt2Gtr8V8nf-NWfaSbMMRo4YLIa
Exception address : 007A1336
Exception Time : 2023-03-29 16:09:57.072
------------------------------------------------------------------------------------------------------------------------
Application Name : Comogest_FAC_BO2Web.exe
Application Version: 1.0.0.0
Started at : 2023-03-29 16:09:06.359
Running for : 50 seconds
Computer Name : MAGICIAN-69
Compiler Version : 320
------------------------------------------------------------------------------------------------------------------------
IntraWeb Version : 15.2.69
Multi-session : False
Content Path : E:\Executaveis\Comogest_FAC_BO2Web\wwwroot\
Session count : 0
------------------------------------------------------------------------------------------------------------------------
Session ID : Vt2Gtr8V8nf-NWfaSbMMRo4YLIa
Client IP address : 127.0.0.1
Request PathInfo : /facbo2web/$/callback
Request Method : POST
Request User Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Cookies Count : 5
------------------------------------------------------------------------------------------------------------------------
(003A0331){Comogest_FAC_BO2Web.exe} [007A1331] IWServerSession.TIWServerSession.GetSession$qqrx20System.UnicodeString (Line 1148, "IWServerSession.pas" + 19) + $16
(0039F260){Comogest_FAC_BO2Web.exe} [007A0260] IWServerSession.TIWServerSession.ExecuteSession$qqrx20System.UnicodeString (Line 853, "IWServerSession.pas" + 36) + $6
(0038CCA8){Comogest_FAC_BO2Web.exe} [0078DCA8] IWServer.TIWServer.ExecuteUrl (Line 676, "IWServer.pas" + 79) + $6
(0038D1E4){Comogest_FAC_BO2Web.exe} [0078E1E4] IWServer.TIWServer.Execute (Line 761, "IWServer.pas" + 17) + $6
(0039B94B){Comogest_FAC_BO2Web.exe} [0079C94B] IWServerSession.HttpExecute$qqrpuci (Line 97, "IWServerSession.pas" + 2) + $3
(0041E362){Comogest_FAC_BO2Web.exe} [0081F362] IW.Server.HTTPIndy.Server.Httpindy.THTTPServerIndy.DoCommandGet (Line 246, "IW.Server.HTTPIndy.pas" + 26) + $19
(00400A09){Comogest_FAC_BO2Web.exe} [00801A09] InCustomHTTPServer.TInCustomHTTPServer.GetSessionFromCookie (Line 1559, "InCustomHTTPServer.pas" + 30) + $10
(004004A5){Comogest_FAC_BO2Web.exe} [008014A5] InCustomHTTPServer.TInCustomHTTPServer.DoExecute (Line 1427, "InCustomHTTPServer.pas" + 180) + $F
(003D80D7){Comogest_FAC_BO2Web.exe} [007D90D7] InContext.TInContext.Run (Line 185, "InContext.pas" + 2) + $7
(003D6E72){Comogest_FAC_BO2Web.exe} [007D7E72] InTask.TInTask.DoRun (Line 136, "InTask.pas" + 0) + $2
(003EE802){Comogest_FAC_BO2Web.exe} [007EF802] InThread.TInThreadWithTask.Run (Line 626, "InThread.pas" + 1) + $3
(003EE1AD){Comogest_FAC_BO2Web.exe} [007EF1AD] InThread.TInThread.Execute (Line 378, "InThread.pas" + 43) + $5
(000D5565){Comogest_FAC_BO2Web.exe} [004D6565] System.Classes.ThreadProc$qqrxp22System.Classes.TThread + $49
(0000B420){Comogest_FAC_BO2Web.exe} [0040C420] System.ThreadWrapper$qqspv (Line 63241, "SynCommons.pas" + 0) + $1A3D

------------------------------------------------------------------------------------------------------------------------

Why, is the question?
Reply
#3
>>Request PathInfo : /facbo2web/$/callback

If you are using an AsyncClick event for your terminate button try with an OnClick instead.
Reply
#4
(03-30-2023, 02:01 PM)MJS@mjs.us Wrote: >>Request PathInfo : /facbo2web/$/callback

If you are using an AsyncClick event for your terminate button try with an OnClick instead.

TIWBSButton do not have an OnClick event.

Problem solved.
It was a TIWTimer component that I was enabling on the OnRefreshForm event that was causing the problem.
Reply
#5
WebApplication.TerminateAndRedirect(mURL);
WebApplication.Redirect(lbPayLink.Caption,false);

There is a question. How do I open a URL in a new browser window?

This is necessary so that after reading the information in the open window, you can go back to the IW window.

I need to open a page of another site in a separate browser window and continue working in the IW application
Reply
#6
WebApplication.NewWindow(url) should work.
Reply
#7
Thanks! That's great!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)