When running an ISAPI application on IIS, if we call ParamStr(0)
or Application.ExeName
inside our ISAPI we will get the folder that IIS is installed (C:\windows...).
Is there any way of getting the folder path which contains my ISAPI instead of IIS's application folder?
Your ISAPI application is a library (DLL), therefore you can use this approach to get its folder:
ExtractFilePath(GetModuleName(HInstance))
Use ExtractFileDir()
instead of ExtractFilePath()
if you don't need the last backslash.
Rationale: According to Delphi docs,
Several variables declared in the System unit are of special interest to those programming libraries. ... During a library's lifetime, HInstance contains its instance handle.
Using GetModuleName() you get that DLL's file name. ParamStr(0), on the other hand, contains the name of the main EXE where this DLL has been loaded to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With