Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread browser cache ..
Sun, Feb 21 2016 9:12 PMPermanent Link

Bruno Larochelle

greetings

i'm new at using Delphi to make EWB modules, quick question :

I have a module, and the following 'execute function' (based on help files etc). This module is used to authenticate a user (eventually to be run on an httpS, when that becomes available on ewbsrvr) :

procedure TewbModuleMain.EWBModuleExecute(Request: TEWBServerRequest);
begin

//let me assume for now this is a 'rmGet', to simplify code (for now)
// Tell browser not to cache response   (this is IMPORTANT!)

Request.ResponseHeaders.Add('Cache-Control: no-cache');

if AuthenticateUser(Request)
 then request.SendContent('welcome!',200)
 else request.SendContent('go away!',200);

end;

////////

Paired up with an EWB web app, this works fine (checks the user name against a DBISAM table). However, the 'no-cache' does not appear to work. I can 'log in' once, but trying a second time is refused, unless i refresh the browser.

I'm using ewb 2.04b1, with matching module components on Delphi XE2. I"m running on Windows 10 with Chrome and Edge.. both exhibit the same behavior.

thanks for any pointers you might have

.. Bruno

(and.. by the way.. ewb2 is nothing short of amazing, i'm glad that i've started to explore the possibilities with the modules/plugins)

Bruno Larochelle
Logiciels Bitwise Software
Edmonton, AB, Canada
Mon, Feb 22 2016 2:30 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bruno,

<< Paired up with an EWB web app, this works fine (checks the user name against a DBISAM table). However, the 'no-cache' does not appear to work. I can 'log in' once, but trying a second time is refused, unless i refresh the browser. >>

Are you just seeing the "Go away" message, or something else like a 404 ?  Is the source code literally just that small bit that you posted ?  If so, then if you could post or email me the EWB client code that you're using, I can take it from there and see what's going on.

<< (and.. by the way.. ewb2 is nothing short of amazing, i'm glad that i've started to explore the possibilities with the modules/plugins) >>

Fantastic, I'm glad that you like it. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Feb 23 2016 5:06 PMPermanent Link

Bruno Larochelle

Tim.. as always, thanks for your comments. I did resolve it, mostly I had not properly though of how the http headers were being prepared :

httpLogin.requestHeaders.clear; //I had forgotten to do this, uggh

httpLogin.requestHeaders.add('X-EWBUser: ' + edtUser.text);
httpLogin.requestHeaders.add('X-EWBPassword: ' + edtPassword.text);

//launch the request
httpLogin.execute;


all good now!

Bruno Larochelle
Logiciels Bitwise Software
Edmonton, AB, Canada
Wed, Feb 24 2016 11:29 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Bruno,

<< all good now! >>

Great, I'm glad that you got it working.

Thanks for the update.

Tim Young
Elevate Software
www.elevatesoft.com
Image