MapPath Strange behavior locally

Discussion in 'ASP General' started by Ahmed El Lakani, May 10, 2004.

  1. 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
     
    Ahmed El Lakani, May 10, 2004
    #1
    1. Advertising

  2. Ahmed El Lakani

    Ray at Guest

    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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Ray at, May 10, 2004
    #2
    1. Advertising

  3. 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:#...
    > 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" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
     
    Ahmed El Lakani, May 10, 2004
    #3
  4. Ahmed El Lakani

    Ray at Guest

    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" <> wrote in message
    news:%...
    > 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:#...
    > > 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" <> wrote in message
    > > news:...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
     
    Ray at, May 10, 2004
    #4
  5. 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:...
    > 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" <> wrote in message
    > news:%...
    > > 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:#...
    > > > 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" <> wrote in message
    > > > news:...
    > > > > 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
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Ahmed El Lakani, May 10, 2004
    #5
  6. Ahmed El Lakani

    Patrice Guest

    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 écrit dans le message de
    news:%...
    > 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:...
    > > 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" <> wrote in message
    > > news:%...
    > > > 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:#...
    > > > > 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" <> wrote in message
    > > > > news:...
    > > > > > 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
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Patrice, May 10, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raghu Rudra

    Different behavior locally vs remotely

    Raghu Rudra, Jul 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    336
    Raghu Rudra
    Jul 21, 2003
  2. Ahmed El Lakani

    MapPath Strange behavior locally

    Ahmed El Lakani, May 10, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    416
    Patrice
    May 10, 2004
  3. =?Utf-8?B?dHBhcmtzNjk=?=

    server.mappath vs. request.mappath

    =?Utf-8?B?dHBhcmtzNjk=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,180
    Juan T. Llibre
    Mar 11, 2007
  4. Replies:
    4
    Views:
    995
    Juan T. Llibre
    Oct 7, 2007
  5. AAaron123
    Replies:
    11
    Views:
    1,208
    AAaron123
    Sep 9, 2009
Loading...

Share This Page