in a procedure / function TWebModule, how to get the current request?
I tried:
procedure TWebModule1.DoSomething;
var
aRequest : TWebRequest;
begin
aRequest := Request;
end;
but this is the first request created at creation TWebModule.
I know that I can transfer the request for subsequent procedures / functions from each TWebActionItem, but I want to avoid passing the request every time. Any tips?
Update
After digging into the code, I found a WebContext and it looks like this solution, for example:
uses Web.WebCntxt;
procedure TWebModule1.DoSomething;
var
aRequest : TWebRequest;
begin
if WebContext <> nil then
aRequest := WebContext.Request;
end;
Is it correct? WebContextIt seems always nil.
I am in the Delphi Berlin 2 update.
source
share