web 2.0

ASP Server.MapPath() - Server Object

ASP Server.MapPath() - Application Object Returns the physical file path that corresponds to the specified virtual path on the Web server.

ShotDev Focus:

- The physical file path that corresponds to path.

Example

asp_server_mappath.asp


<% Option Explicit %>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<%
Dim FSO,objFile
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
'*** thaicreate.txt Path  C:\Inetpub\wwwroot\myasp\MyFiles\shotdev.txt ***'
Set objFile = FSO.OpenTextFile(Server.MapPath("shotdev.txt"), 1)
Response.Write(objFile.ReadAll)
objFile.Close
Set objFile=Nothing
Set FSO=Nothing
%>
</body>
</html>

Create a asp file and save to path root-path/myasp/

Run

http://localhost/myasp/asp_server_mappath.asp

Screenshot

ASP & Server.MapPath()

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.