Use ASP to determine the Physical Path Of Your Virtual Website
Here is an example if you are hosting your Domain on some random ISP and you
want to know
the structure of the web site without asking them.
The Mapath Method Is your ticket.
Run the following code from within the root of your site and it
will clue you in to the physical path.
<p
align="center"><font size="4"
face="Arial"><b>
The Physical path to this virtual website is:
</b></font>
<font color="#FF0000" size="6" face="Arial">
<%= Server.MapPath("\")%>
</font></p>
Server.MapPath is a great tool, but it isn't always
the best solution. It is great for applications that need to work from any
directory or site they are thrown into but there are times when you just
don't need to use it. All Server.MapPath really does is figure out the physical path on the fly. Using it is really no different then knowing the path except every time Server.MapPath is called you are using server resources
to determine the physical path. Also. when called from all sorts of different directories Server.MapPath will report back all sorts
of different paths making it pretty difficult to use with an application that uses include files for specifying the database path.
The solution...
Just use Server.MapPath once to determine the physical path ..
There is a Physical Path despite what your host may have told you.
|