VL-Web - Widget and session key

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
User avatar
ahj_dk
Posts: 20
Joined: Wed Mar 09, 2016 9:10 pm

VL-Web - Widget and session key

Post by ahj_dk » Tue Apr 12, 2016 4:54 pm

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 ?
Regards
Allan Jakobsen
Futura Data A/S

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: VL-Web - Widget and session key

Post by Stewart Marshall » Tue Apr 12, 2016 6:40 pm

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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

User avatar
ahj_dk
Posts: 20
Joined: Wed Mar 09, 2016 9:10 pm

Re: VL-Web - Widget and session key

Post by ahj_dk » Tue Apr 12, 2016 10:33 pm

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.
Regards
Allan Jakobsen
Futura Data A/S

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: VL-Web - Widget and session key

Post by Stewart Marshall » Wed Apr 13, 2016 8:09 am

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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

User avatar
ahj_dk
Posts: 20
Joined: Wed Mar 09, 2016 9:10 pm

Re: VL-Web - Widget and session key

Post by ahj_dk » Wed Apr 13, 2016 4:03 pm

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.
Regards
Allan Jakobsen
Futura Data A/S

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: VL-Web - Widget and session key

Post by Stewart Marshall » Wed Apr 13, 2016 5:13 pm

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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

dannyoorburg
Posts: 156
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: VL-Web - Widget and session key

Post by dannyoorburg » Wed Apr 13, 2016 5:40 pm

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

User avatar
ahj_dk
Posts: 20
Joined: Wed Mar 09, 2016 9:10 pm

Re: VL-Web - Widget and session key

Post by ahj_dk » Fri Apr 15, 2016 6:22 pm

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
Regards
Allan Jakobsen
Futura Data A/S

Post Reply