If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Server MapPath Issue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-04, 00:12
Patrick Chua Patrick Chua is offline
Registered User
 
Join Date: Jul 2003
Location: Penang, Malaysia
Posts: 212
Server MapPath Issue

I wrote this in my asp page:

response.Write Server.MapPath(Request.ServerVariables("PATH_INFO" ))

I got this:
c:\inetpub\wwwroot\testupload\test1.asp


I want only until:
c:\inetpub\wwwroot\testupload\

I tried this:
response.Write Server.MapPath("/")

but got this instead:
c:\inetpub\wwwroot

So can anybody help?
__________________
Patrick Chua
LBMS ( Learn By My Self) NPQ ( No paper Qualification )
Reply With Quote
  #2 (permalink)  
Old 01-26-04, 01:04
Patrick Chua Patrick Chua is offline
Registered User
 
Join Date: Jul 2003
Location: Penang, Malaysia
Posts: 212
Okay...I'll answer my own question...
Code:
Set fs=Server.CreateObject("Scripting.FileSystemObject")
p=fs.GetParentFolderName(Server.MapPath(Request.ServerVariables("PATH_INFO")))

Response.Write("The parent folder name is: " & p)

set fs=nothing
__________________
Patrick Chua
LBMS ( Learn By My Self) NPQ ( No paper Qualification )
Reply With Quote
  #3 (permalink)  
Old 02-03-04, 04:14
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
And here are some other somewhat similar cool things you can do:

<%
'!!!
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 Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On