ASP MapPath Method
Complete Server Object Reference
The MapPath method maps a specified path to a physical path.
Note: This method cannot be used in Session.OnEnd and Application.OnEnd.
Syntax
Parameter |
Description |
path |
Required. A relative or virtual path to map to a physical
path. If this parameter starts with / or \, it returns a path as if this
parameter is a full virtual path. If this parameter doesn't start with /
or \, it returns a path relative to the directory of the .asp file being
processed |
Examples
Example 1
For the example below, the file test.asp is located in C:\Inetpub\Wwwroot\Script.
The file Test.asp (located in C:\Inetpub\Wwwroot\Script) contains the
following code:
<%
response.write(Server.MapPath("test.asp") & "<br />")
response.write(Server.MapPath("script/test.asp") & "<br />")
response.write(Server.MapPath("/script/test.asp") & "<br />")
response.write(Server.MapPath("\script") & "<br />")
response.write(Server.MapPath("/") & "<br />")
response.write(Server.MapPath("\") & "<br />")
%>
Output:
c:\inetpub\wwwroot\script\test.asp
c:\inetpub\wwwroot\script\script\test.asp
c:\inetpub\wwwroot\script\test.asp
c:\inetpub\wwwroot\script
c:\inetpub\wwwroot
c:\inetpub\wwwroot
Example 2
How to use a relative path to return the relative physical path to the page that is being viewed in the
browser:
<%
response.write(Server.MapPath("../"))
%>
or
<%
response.write(Server.MapPath("..\"))
%>
|
Complete Server Object Reference
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
|