Page 1 of 1

iSeries VL Web Session expiring after downloading file

Posted: Fri May 17, 2024 8:42 pm
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?

Re: iSeries VL Web Session expiring after downloading file

Posted: Fri May 17, 2024 10:36 pm
by René Houba
Hi Cesar,

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


Kind regards,
René

Re: iSeries VL Web Session expiring after downloading file

Posted: Sat May 18, 2024 1:26 am
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...

Re: iSeries VL Web Session expiring after downloading file

Posted: Mon May 27, 2024 7:45 am
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

Re: iSeries VL Web Session expiring after downloading file

Posted: Wed May 29, 2024 7:06 pm
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,