On Wed, 28 Mar 2012, leledumbo wrote:

I'm currently building a web app using HTTP server application project +
fpweb + tiopf (with sqlite backend). However, I'm stuck in this scenario:

Imagine a user log's in to my web app, which could be done from any page
(it's part of the layout), how can I:
Save login data in session, in case the login is successful, and reuse it in
certain pages requiring login

Save Session data in login request handler:

Session.Variables['UserID']:='XYZ';

In every request that needs a login, do a

if (Session.Variables['UserID']='') then
   Response.SendRedirect('Yourloginurl');

Redirect the request back to its referer (I could get the referer from
ARequest.Referer)

Do something like this:

if LoginSuccesfull then
  begin
  Session.Variables['UserID']:='XYZ';
  Response.SendRedirect(ARequest.Referer);
  Exit;
  end;


Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to