I have set of files (which are essentially ".exe" files) that I allow the users to download from my website. To have a clearer picture have a look at the this screenshot (it is just a academic project). Now I have administrator privilege in which I can upload a new software file to a folder (componentsFolder) to the root of my website and I also add the filepath to the database table at the same time.
I'm using the following code to do that:
string componentRelativeFilePath = @"/ComponentsFolder/" + ComponentName;
I'm storing the filepath in the following format in the database file: /ComponentsFolder/FileName.exe
What is the difference between storing the files in the following formats?
- /ComponentsFolder/FileName.exe
- \ComponentsFolder\FileName.exe
- ~/ComponentsFolder/FileName.exe
- ~\ComponentsFolder\FileName.exe
I'm using server.mappath to retrieve the file from the root folder.
I want to know the difference (in this context) between these formats and which one is the standard/appropriate/technically correct format to store the relative paths in database table.