Trying to redirect page on miserver

MiServer is Dyalog's APL-based web development framework

Trying to redirect page on miserver

Postby Gantois on Sun Apr 02, 2017 12:00 pm

Hi Friends,

I can not redirect a page using meta tag after identify that user session is out. "Meta" instruction is bypassed in this case. What could I do to solve this?

∇ Render req;html;stop;⎕TRAP;rc
:Access Public
ilogin←⎕NEW #.fileLogins
:If ilogin.SessionOut req.Session.State.login req.Session.ID ⍝ return 1=true 0=false
req.Meta'http-equiv="refresh" content="1;URL=/index.dyalog"'
⍝ req.Meta'http-equiv="refresh" content="1;URL=/timeoutMsg.dyalog"'

ilogin.SessionOut function is identifying correctly that session is out. The :If result is true, the process go to next instruction (meta) but continue after :EndIf.

Posts: 75
Joined: Thu Apr 17, 2014 9:44 am

Re: Trying to redirect page on miserver

Postby Brian|Dyalog on Fri Apr 07, 2017 2:31 pm

Hi Marco,

I'm not sure I understand the nature of your problem.
I would expect processing to continue after the :EndIf.
If you want no more processing to take place on the page after you insert the <meta> element, then insert a →0 within the :If/:EndIf clause.

If that's not the issue, then could you give me a little more explanation of the problem?

I hope this helps!
User avatar
Posts: 99
Joined: Thu Nov 26, 2009 4:02 pm
Location: West Henrietta, NY

Re: Trying to redirect page on miserver

Postby Gantois on Tue Apr 11, 2017 12:55 pm

Hi Brian,

I'll do more tests and if necessary I'll send you more information about it.

Posts: 75
Joined: Thu Apr 17, 2014 9:44 am

Re: Trying to redirect page on miserver

Postby woody on Tue Feb 19, 2019 5:04 pm

One trick that I use for keeping track of users ...
is to WRITE TO APL FILE the user login name and MiServer SessionID and timestamp.

If user logs in to your application, then MiServer will setup a unique MiServer SessionID (and send the user's browser a unique Cookie for that session).

You need to write this user session data to an APL file.
You can also include other interesting data for this user's Session record.

MiServer will keep the SessionID "active" for a few minutes (e.g. 10 minutes) ...
So, if the user visits again ... you can check that user's SessionID.

If the user's Session ID is in your APL FILE DATA ... then you know about that user, and their current session information.

In fact, any global variables created in the user's Session will remain ACTIVE as long as that session remains active.

This technique can help you manage a user's multiple return visits to your MiServer application.

NOTE: If you limit the user's session to ONLY the MiServer session TIMEOUT .. (10 minutes) then you can simply keep the user data in global variables inside the user's unique MiServer session.

So, when the next HTTP GET comes in for that user, they will be directed to their current Session ... and the APL MiPage code can REFERENCE any of the Global Variables for that user.

This way, you can KNOW about a user's current session... and if needed, RETURN a new page or a HTTP 302 redirect to send the user to some other HTTP page, as needed.

Hope that helps.

Woodley Butler
Automatonics, Inc.
"Find your head in the APL Cloud"
User avatar
Posts: 121
Joined: Tue Dec 28, 2010 12:54 am
Location: Atlanta, Georgia USA

Return to MiServer

Who is online

Users browsing this forum: No registered users and 1 guest