iSeries VL Web Session expiring after downloading file

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
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

iSeries VL Web Session expiring after downloading file

Post by cesarrafael »

Hi All,

Has anyone had issues with sessions expiring after downloading a document from an iSeries using VL Web?
We're using VL150040, iSeries V7R5M0 and our routine looks something like this (we have others similar):

Srvroutine Name(GetPDFFile) Response(*RESOURCE #Response)
Field_Map For(*INPUT) Field(#pdfGenPath) Parameter_Name(pdfPath)
Field_Map For(*INPUT) Field(#pdfName) Parameter_Name(pdfName)
Field_Map For(*INPUT) Field(#UserWebID) Parameter_Name(User)

#Response.ContentFile := #pdfGenPath.trim + #pdfName.Trim

#Response.AttachmentFileName := #pdfName.Trim
#Response.ContentType := "application/pdf"

Endroutine

After running this code, when we try to reach other parts of the application, our session has "expired"!
Anyone experienced something like this?
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: iSeries VL Web Session expiring after downloading file

Post by René Houba »

Hi Cesar,

What if you add the Session(*REQUIRED) parameter to the svrroutine?


Kind regards,
René
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: iSeries VL Web Session expiring after downloading file

Post by cesarrafael »

Nope....Still get a session expired after downloading the file....it's very strange...something is causing the session to expire or, maybe, starting a new Lweb_job and causing the session to be invalid...
JimmyD
Posts: 1
Joined: Tue Jul 18, 2023 8:33 am

Re: iSeries VL Web Session expiring after downloading file

Post by JimmyD »

Hi Cesar,

What does the call to the server routine look like on the client?
I believe you are getting this behaviour because the target for the download is specified as current. Try specifying the target as new before you call the server module execute. I also recommend keeping session required on this server routine so it cannot be called without a valid session.

For example:

Mthroutine Name(DownloadDocument)
Define_Com Class(#DocumentDataServer.GetPDFFile) Name(#GetPDFFile)

#GetPDFFile.Target := New
#GetPDFFile.Execute

Endroutine
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: iSeries VL Web Session expiring after downloading file

Post by cesarrafael »

Hi Jimmy,

Many thanks! That worked perfectly!
I wonder why that happens....We're using the Target(Current) on other different pages with no problem at all!

Anyway, that was very helpfull.

Cheers,
Post Reply