Maintain a user session

Chong-ho (Alex) Yu, Ph.D., MCSE, CNE

Problem:

HTTP is stateless and connectionless. Since the Web server does not recognize the user, every page request is treated as a fresh request. However, I want to let the user "maintain the session." To be specific, when the user accesses two or more databases through the Web, he/she does not need to relogin over and over, given that Web security is not used.

Solution:

There are several ways to achieve this goal such as using record ID, cookie, and token. I prefer the last method to the other two. Basically, the token passing method is to capture a value into a token. This token can be passed to other pages and the value contained in the token can be used later. To create a token, in the first page insert the following hidden input. If you want to put more than one field value into the token, use a comma to separate them:


	<INPUT TYPE="hidden" NAME="-token" VALUE="[FMP-field:user_ID]">

To keep on passing the token, the subsequent pages should carry the following hidden input even if the token is not used in those pages:


	<INPUT TYPE="hidden" NAME="-token" VALUE="[FMP-CurrentToken]">

At some point the user may leave the current database and go into another database. The following hidden input can let the user open another database without relogging in.

 


	<INPUT TYPE="hidden" NAME="-op" VALUE=eq> 
	<INPUT TYPE=hidden NAME="user_ID" VALUE="[FMP-CurrentToken]">

 


Navigation

FMP Tips Contents

Other computer tips

Search Engine

Credit/Copyright ©

Simplified Navigation

Table of Contents

Contact Me