Page 1 of 1

VL-Web - Widget and session key

Posted: Tue Apr 12, 2016 4:54 pm
by ahj_dk
Hi,

I'm trying to find a way to get the session key value in a widget, so I can post it in a form to external site and return to the same session.

As a last resort I could use javascript to pass the 2. <script> tag to find the session key, but hope there is a better way.

Do anyone know of a way to get the session key ?

Re: VL-Web - Widget and session key

Posted: Tue Apr 12, 2016 6:40 pm
by Stewart Marshall
VL uses the session key to manage its relationship with the server. For most scenarios, this is really little more than a start and end boundary.

A Widget instance exists within a stateful VL page, so it will maintain its session while the widget does whatever it needs to do. So I'm a little confused as to why you'd need access to the session key.

Of course, it may well be that you have a requirement we simply haven't thought of yet, or just a bug, so could you please provide a fuller explanation of the problem you're trying to solve and the issues you're experiencing.

Thanks

Re: VL-Web - Widget and session key

Posted: Tue Apr 12, 2016 10:33 pm
by ahj_dk
What I need is a way to post the session key to a custom url, and combine this with mod_rewrite to have "pretty" urls.
I would then use a widget to handle post requests.

Maybe this is the wrong way to handle this?

I would use session on the server to handle customer data, and handle if the user is logged on.

Re: VL-Web - Widget and session key

Posted: Wed Apr 13, 2016 8:09 am
by Stewart Marshall
Hi Allan

"Maybe this is the wrong way to handle this?"

My apologies for my ignorance, but I'm still not clear as to what "this" is.

Can you explain what you want the application to do in really simple terms. From what I understand so far, you have a web page that will use a widget to post to a 3rd party service. Is this for something like a credit card?

Also, with reference to the use of mod_rewrite, VL web applications are typically single page, so I'm confused by the need to play around with the URL beyond the initial page request.

Thanks

Re: VL-Web - Widget and session key

Posted: Wed Apr 13, 2016 4:03 pm
by ahj_dk
Hi Stewart,

I'm building an application like the Tools sample and have used it as reference.

But the user needs to login before the can use the application.

And I need to post a form to something like a credit card, and if I could post the session key the credit card application could post it back to remain in the same session.

Re: VL-Web - Widget and session key

Posted: Wed Apr 13, 2016 5:13 pm
by Stewart Marshall
Hi Allan

You don't need to leave the VL page when you post to a separate URL

I think the answer you're looking for is in the thread below.

http://vlforum.lansa.com.au/viewtopic.php?f=3&t=36

The Tools demo itself is an example of a multi-page application to demonstrate that such things are possible. However, VL is best suited to single page applications where parts of the UI are replaced as required, rather than the whole page being replaced by navigating to a new URL. Single page applications are much closer in architecture to a Windows application design.


Regards

Re: VL-Web - Widget and session key

Posted: Wed Apr 13, 2016 5:40 pm
by dannyoorburg
Hi,

I'm not sure if I understand the use case (I'd like to), but I just thought I'd let you know that there's always the option of letting the session-key travel as a (secure) cookie through the SessionKeyMethod property on the Server Module, as in:

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_SRVM) SessionKeyMethod(Cookie)
in that case, when you return to your Web Page you will still be using the same session.

Danny

Re: VL-Web - Widget and session key

Posted: Fri Apr 15, 2016 6:22 pm
by ahj_dk
Thanks Danny,

I think, I will use SessionKeyMethod(Cookie).

Missed it, because it wasn't in the docs http://docs.lansa.com/140/EN/lansa016/PRIM_SRVM.htm