Atozed Forums
TIWServerController::OnBeforNewSession() - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: TIWServerController::OnBeforNewSession() (/thread-526.html)



TIWServerController::OnBeforNewSession() - JuergenS - 07-26-2018

Hello,

setting the flag vCanCreate = false in the OnBeforNewSession event handler of the server controller
doesn't prevent the server controller from creating a new session !

C++Builder 10.2 Update 3
Intraweb Ultimate Edition 15.0.9

Best Regards
JuergenS


RE: TIWServerController::OnBeforNewSession() - Alexandre Machado - 07-31-2018

(07-26-2018, 11:34 AM)JuergenS Wrote: Hello,

setting the flag vCanCreate = false in the OnBeforNewSession event handler of the server controller
doesn't prevent the server controller from creating a new session !

C++Builder 10.2 Update 3
Intraweb Ultimate Edition 15.0.9

Best Regards
JuergenS

Hello,

are you sure? What type of server are you using (Indy, Http.sys, ISAPI)? 

I've just tested it in one of our test case apps and it works as expected...

Do you have any other code handling requests directly (other events like OnBeforeDispatch)?


RE: TIWServerController::OnBeforNewSession() - JuergenS - 08-01-2018

(07-31-2018, 04:51 PM)Alexandre Machado Wrote:
(07-26-2018, 11:34 AM)JuergenS Wrote: Hello,

setting the flag vCanCreate = false in the OnBeforNewSession event handler of the server controller
doesn't prevent the server controller from creating a new session !

C++Builder 10.2 Update 3
Intraweb Ultimate Edition 15.0.9

Best Regards
JuergenS

Hello,

are you sure? What type of server are you using (Indy, Http.sys, ISAPI)? 

I've just tested it in one of our test case apps and it works as expected...

Do you have any other code handling requests directly (other events like OnBeforeDispatch)?

Hi Alexandre,

i'm using the default Indy server type.

I  have created a new standard Indy server project with the event IWServerControllerBaseBeforeNewSession() :

void __fastcall TIWServerController::IWServerControllerBaseNewSession(
      TIWApplication *ASession)
{
  ASession->Data = new TIWUserSession(NULL, ASession);
}

void __fastcall TIWServerController::IWServerControllerBaseBeforeNewSession(const UnicodeString aUrlPath,
          THttpRequest *aRequest, bool vCanCreate)
{
    vCanCreate = false;
}

IWServerControllerBaseNewSession() is always called, no matter what value is assigned to vCanCreate ;