Brinkster Working Examples
This function will produce a physical path based on the information you pass it (''within the quotation marks'') and the current path of the file you are working out of. It will not give you an error if the information you pass it is incorrect. It just assumes the information is correct.
So, double check the result with your directory structure.
Using <%Server.MapPath (''FileInUse.asp'')%> you can find the path of the file you are currently using.
Using Server.MapPath you can see that this file is located at:
Referencing Other Files
Let's say we want to reference a file called ''Test.asp''. We know this file is located at ''WebRoot\TestFiles\Test.asp''. The file we a currently working in is located at ''Webroot\Production\Working.asp''. So, how do we reference ''Test.asp'' from the file ''Working.asp''?
Just like this. <%Server.MapPath (''\TestFiles\Test.asp'')%>
By putting the ''\'' at the beginning we are telling ASP to start at the WebRoot directory and move into the TestFiles directory looking for the Test.asp file.
Now let's say we want to reference a file called ''FindMe.asp''. We know this file is located at ''WebRoot\Production\Search\FindMe.asp''. We are still working at ''Webroot\Production\Working.asp''. So how do we get to ''FindMe.asp''.
With a small change. <%Server.MapPath (''Search\FindMe.asp'')%>
This time we did not use the ''\''. We are starting from our current directory (Production) going up one (to Search) and then referencing FindMe.asp.
Referencing Your DataBase
As a Premium Member your database can be located outside of you webroot directory. This is done so that it can not be downloaded when a person references it in the URL.
The path should look like this:
Make sure you put your database in the Database directory. The Database directory is the only directory with write permissions.
Referencing Include Files
There are two different ways to reference an Include.
<!-- #Include Virtual=''/includes/FileName.asp --> or <!-- #Include File=''includes\FileName.asp'' -->
With Include Virtual you can only reference files within your virtual directories (everything back to the WebRoot). The same principles apply to Include Virtual as they did with Server.MapPath. Again, if you put a ''/'' at the beginning of the reference you will start at the WebRoot directory and so on.
With Include File you can use the entire path to reference the file.
<!-- #Include File=''E:\sites\Pungo4\newyorkbookfestwebroot\includes\FileName.asp'' -->
Or, you can start at the directory you are in. In this case we are starting in the WebRoot directory, then moving into the Includes directory, referencing FileName.asp.
<!-- #Include File=''includes\FileName.asp'' -->
You can not put a ''\'' at the beginning to start at the WebRoot directory when using Include File.