MapPath Strange behavior locally

A

Ahmed El Lakani

hi all,

i've a legacy ASP.NTT code that works fine, but now i'm trying to add new
feature

so i get the files from our source safe and put them in "d:\Projects\mySite"

and created a new virtual directory for it and make it point to the project
Directory

, till now every thing is ok,

the problem is that Server.MapPath("/") returns "c:\inetpub\wwwroot" ???

i dont know why, while it works fine on site

i'm running IIS 5 on win2000 pro

thanks,

with my best regards
 
R

Ray at

That is expected behavior. / is the root of your site, regardless of where
you are, so when that path is translated to the file system, it is where the
root of your site is. This is C:\Inetpub\wwwroot in a default
configuration.

../ would work for you.

Ray at work
 
A

Ahmed El Lakani

Thanks Ray,

mmmm, but how it was installed on hosting machine ????
is this mean that its installed on the root ????, or some thing that isn't
avilable on win2000 pro
if that, so how i'm going to change it to work on both sides ??? my pc and
the host ?
 
R

Ray at

I don't really understand your questions or what the issue is. Can you
rexplain or explain what's not working for you?

Ray at work
 
A

Ahmed El Lakani

i'm just asking on how to change the call to MapPath
to make it machine independent and also path independent ????

Thanks for your help
 
P

Patrice

As stated by Ray Server.MapPath ("./") which is the path of the current
directory.

Server.MapPath("/") is the path of the root directory for the site. Your web
application could be anywhere under the root such as
c:\root\external\yourname\yourapp and it can't be machine independant.

Server.MapPath("~/") will give you the root of your application
(c:\root\external\yourname\yourapp) while Server.mapPath("/") will give
c:\root.

Patrice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top