I have a Delphi ISAPI DLL(32 bit) built with Delphi XE SPI, and hosted on a server running WinServer 2008 RS2 and IIS 7.5.
See MSDN:
Initialization Using GetExtensionVersion:
Initialization is handled by the entry-point function GetExtensionVersion. This function's role is to perform all initialization, including the creation of worker threads, synchronization objects, and database connections, and to establish the version of ISAPI that was used to build the DLL.
In my ISAPI DLL I am using GetExtensionVersion
to perform initializations as per the above MSDN reference. GetExtensionVersion
is great for initialization of resources that need to persist for the lifetime of the web application, not initialized on a per client request basis, because it's called only once by IIS, when the first request is mapped to your ISAPI DLL. If interested, see How can I make ADO database connections in TISAPIApplication
before processing incoming requests? for more details.
One of my initialization functions takes the URL of the website where that DLL is hosted, but I cannot seem to find any Delphi function or property that exposes the website's URL within the context of GetExtensionVersion
, which runs before the application begins handling the actual client request - that happens in HttpExtensionProc
(which Delphi's TWebApplication
hooks into using TWebActionItem
).
Since my ISAPI DLL is hosted in a website, and GetExtensionVersion
is only called by IIS when a client request is posted to that website, I believe the website's URL should be available somewhere - perhaps through an IIS API call.
How can I grab the URL of my website from within GetExtensionVersion
?