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:
Use
ExtractFileDir()instead ofExtractFilePath()if you don’t need the last backslash.Rationale: According to Delphi docs,
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.