KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Storing Web content in the data file
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: June 20, 2007
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

If you are looking for alternatives of where to place your web files, one place that you might have overlooked is the 4th Dimension data file. Placing your web files in your data file will provide the following benefits:

-Allow more control of requests that the webserver receives, since all URL's coming in will be considered as a "bad url" since no files exist in the web folder. This will trigger the On Web Connection database method.

-When moving the database over from one machine to another, you don't need to worry about moving an extra folder since all the files are in the data file.

-Your files are less likely to be tampered with. For instance, someone can not simply rename a file which might cause an error page or serve an incorrect page.

If you like the following benefits presented above with this alternative, then you should also be aware of the disadvantages.

-Since there are no files in the webfolder, more code will need to be written in order to parse the url, decide if the file being requested is valid, load the file, and finally send it out back to the browser. The command you will most likely use to send the file back to the browser is SEND HTML BLOB.

-Modification of the html files might be of an inconvenience since the files are not easily as accessible compared to as if they were stored in the web folder.