10-22-2019, 08:16 AM
For future reference, this was the response on the Telegram channel:
OnBeforeDispatch does happen multiple times. Each request/response goes through OnBeforeDispatch. During application start up multiple requests are sent to the server. There is nothing wrong there
If you want to block a request before it creates a new session IW 15 gives you the OnBeforeNewSession event
TOnBeforeNewSessionEvent = procedure(const aUrlPath: string; aRequest: THttpRequest; out vCanCreate: Boolean) of object;
Just set vCanCreate to false and the user will get a 404, and no session will be created
OnBeforeDispatch does happen multiple times. Each request/response goes through OnBeforeDispatch. During application start up multiple requests are sent to the server. There is nothing wrong there
If you want to block a request before it creates a new session IW 15 gives you the OnBeforeNewSession event
TOnBeforeNewSessionEvent = procedure(const aUrlPath: string; aRequest: THttpRequest; out vCanCreate: Boolean) of object;
Just set vCanCreate to false and the user will get a 404, and no session will be created