Forum > Networking and Web Programming

Help needed for usage of session in fpweb

(1/2) > >>

william:
Hi all,

I have a bit confused how session work in fpweb. I tried to implement a login page and store the user id in session after a succession log on. However I found that the session ID is being generated upon every request? i.e. always a new session for every web request. I am using embedded server with iniwebsession at the moment for development.

Any idea?

trev:
Welcome!

The Wiki has a fpWeb Tutorial which includes a section on sessions: see https://wiki.lazarus.freepascal.org/fpWeb_Tutorial#Sessions

william:
Following the tutorial I am able to create a simple web application. However I am not sure why a new session will be created on every request. Attached is a very simple project with a single page showing the session id. By refreshing the page http://localhost:8080/TFPWebModule1 I will get new session upon every refresh even using the same tab on the same browser. I suppose I should get a single session until it is expired?

Leledumbo:

--- Quote from: william on May 19, 2022, 12:55:50 pm ---I will get new session upon every refresh even using the same tab on the same browser. I suppose I should get a single session until it is expired?

--- End quote ---
Can't reproduce. Can you be sure by using developer tools or similar, that FPWebSession cookie is sent back on subsequent requests containing the value returned from the first request?

william:
Thank your very much for your help. The cookie should be set by inspecting using developer tools. Attached please find a capture for a demo.

Navigation

[0] Message Index

[#] Next page

Go to full version