Saturday, March 24, 2012

MapPath Strange behavior locally

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 regardsThat 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

"Ahmed El Lakani" <a@.hotmail.com> wrote in message
news:Ol1Bp8oNEHA.2704@.TK2MSFTNGP10.phx.gbl...
> 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
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 ?

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:#1y4gGpNEHA.1956@.TK2MSFTNGP10.phx.gbl...
> 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
> "Ahmed El Lakani" <a@.hotmail.com> wrote in message
> news:Ol1Bp8oNEHA.2704@.TK2MSFTNGP10.phx.gbl...
> > 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
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

"Ahmed El Lakani" <a@.hotmail.com> wrote in message
news:%23ZyKpJpNEHA.3672@.TK2MSFTNGP11.phx.gbl...
> 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 ?
> "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> message news:#1y4gGpNEHA.1956@.TK2MSFTNGP10.phx.gbl...
> > 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
> > "Ahmed El Lakani" <a@.hotmail.com> wrote in message
> > news:Ol1Bp8oNEHA.2704@.TK2MSFTNGP10.phx.gbl...
> > > 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
> >
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

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:e8RTZOpNEHA.1956@.TK2MSFTNGP10.phx.gbl...
> 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
> "Ahmed El Lakani" <a@.hotmail.com> wrote in message
> news:%23ZyKpJpNEHA.3672@.TK2MSFTNGP11.phx.gbl...
> > 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 ?
> > "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> > message news:#1y4gGpNEHA.1956@.TK2MSFTNGP10.phx.gbl...
> > > 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
> > > > "Ahmed El Lakani" <a@.hotmail.com> wrote in message
> > > news:Ol1Bp8oNEHA.2704@.TK2MSFTNGP10.phx.gbl...
> > > > 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
> > > > > >
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

"Ahmed El Lakani" <a@.hotmail.com> a crit dans le message de
news:%239QpxQpNEHA.3556@.TK2MSFTNGP09.phx.gbl...
> 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
> "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> message news:e8RTZOpNEHA.1956@.TK2MSFTNGP10.phx.gbl...
> > 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
> > "Ahmed El Lakani" <a@.hotmail.com> wrote in message
> > news:%23ZyKpJpNEHA.3672@.TK2MSFTNGP11.phx.gbl...
> > > 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 ?
> > > > "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> > > message news:#1y4gGpNEHA.1956@.TK2MSFTNGP10.phx.gbl...
> > > > 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
> > > > > > "Ahmed El Lakani" <a@.hotmail.com> wrote in message
> > > > news:Ol1Bp8oNEHA.2704@.TK2MSFTNGP10.phx.gbl...
> > > > > 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
> > > > > > > > > > > >

0 comments:

Post a Comment