Reputation: 290
I've created an ISAPI Extension in Delphi which works just fine, but I am wondering if there is a best practice on how to store configuration settings? I can think of a number of ways to do this, but I would of course like to do it the best way. I might have looked in all the wrong places, but I can't find anything that helps me out...
Is an ini or xml file in the same directory as the dll a good way? Or use the windows registry? Or is is possible (and sensible) to put ISAPI Extension-specific configuration in web.config and thereby utilize the IIS Manager to configure? Or something else?
Upvotes: 1
Views: 526
Reputation: 36850
I generally use GetModuleFileName(HInstance);
to find out where the DLL is stored, and keep a file there (ini or xml). It's advisable to keep it, and the DLL, out of reach of IIS so it's not accessible over a URL.
Upvotes: 2
Reputation: 1116
You can use an INI file (make sure it's outside the \InetPub\ folder. Make sure you cache the INI file using TMemIniFile.
You can use a XML file. Make sure you read the XML file to cache and release the file handler after that, to prevent locked files during a concurrent read.
To check for changes while the ISAPI is loaded, check the Date/Time stamp of the XML file before re-reading it again.
Upvotes: 2