Home | Advertising Info27 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Wednesday, January 15, 2025  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Database Issues
 PowerASP Code Help Area : Classic ASP - Database Issues
Subject Info: Using ASP to determine the Physical Path A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: April/27/2004 at 8:09pm | IP Logged Quote cwilliams

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


__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 
Bullschmidt
Newbie
Newbie
Avatar

Joined: July/06/2004
Location: United States
Online Status: Offline
Info: 12
Added: July/06/2004 at 12:53am | IP Logged Quote Bullschmidt

And to see Server.MapPath in action a little more you might try copying this into one of your pages:

<%
Response.Write "Server.MapPath with . : " & Server.MapPath(".") & "<br>"
Response.Write "Server.MapPath with .. : " & Server.MapPath("..") & "<br>"
Response.Write "Server.MapPath with ../logs : " & Server.MapPath("../logs") & "<br>"
Response.Write "Server.MapPath with / : " & Server.MapPath("/") & "<br>"
Response.Write "Server.MapPath with /. : " & Server.MapPath("/.") & "<br>"
Response.Write "Server.MapPath with /.. : " & Server.MapPath("/..") & "<br>"
Response.Write "Server.MapPath with /../ : " & Server.MapPath("/../") & "<br>"
Response.Write "Server.MapPath with /../.. : " & Server.MapPath("/../..") & "<br>"
Response.Write "Server.MapPath with /../../ : " & Server.MapPath("/../../") & "<br>"
Response.Write "Server.MapPath with /../www : " & Server.MapPath("/../www") & "<br>"
Response.Write "Server.MapPath with /../logs : " & Server.MapPath("/../logs") & "<br>"
Response.Write "Server.MapPath with /../hi : " & Server.MapPath("/../hi") & "<br>"
%>



__________________
J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)
Back to Top View Bullschmidt's Profile Search for other info by Bullschmidt Visit Bullschmidt's Homepage
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2025 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages ASP a directory of ASP tutorials applications scripts components and articles for the novice to professional developer. CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com