简体   繁体   中英

Storing ISAPI Extension parameters

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?

  1. You can use an INI file (make sure it's outside the \\InetPub\\ folder. Make sure you cache the INI file using TMemIniFile.

  2. 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.

  1. Another suggestion is to use an in-memory database and load/save the data file to and from disk.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM