MapPath Strange behavior locally

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ahmed El Lakani

    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\my Site"

    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\www root" ???

    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

    #2
    Re: MapPath Strange behavior locally

    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\wwwr oot in a default
    configuration.

    ../ would work for you.

    Ray at work

    "Ahmed El Lakani" <a@hotmail.co m> wrote in message
    news:Ol1Bp8oNEH A.2704@TK2MSFTN GP10.phx.gbl...[color=blue]
    > 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[/color]
    "d:\Projects\my Site"[color=blue]
    >
    > and created a new virtual directory for it and make it point to the[/color]
    project[color=blue]
    > Directory
    >
    > , till now every thing is ok,
    >
    > the problem is that Server.MapPath( "/") returns "c:\inetpub\www root" ???
    >
    > i dont know why, while it works fine on site
    >
    > i'm running IIS 5 on win2000 pro
    >
    > thanks,
    >
    > with my best regards
    >
    >[/color]


    Comment

    • Ahmed El Lakani

      #3
      Re: MapPath Strange behavior locally

      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:#1y4gGpNEH A.1956@TK2MSFTN GP10.phx.gbl...[color=blue]
      > That is expected behavior. / is the root of your site, regardless of[/color]
      where[color=blue]
      > you are, so when that path is translated to the file system, it is where[/color]
      the[color=blue]
      > root of your site is. This is C:\Inetpub\wwwr oot in a default
      > configuration.
      >
      > ./ would work for you.
      >
      > Ray at work
      >
      > "Ahmed El Lakani" <a@hotmail.co m> wrote in message
      > news:Ol1Bp8oNEH A.2704@TK2MSFTN GP10.phx.gbl...[color=green]
      > > hi all,
      > >
      > > i've a legacy ASP.NTT code that works fine, but now i'm trying to add[/color][/color]
      new[color=blue][color=green]
      > > feature
      > >
      > > so i get the files from our source safe and put them in[/color]
      > "d:\Projects\my Site"[color=green]
      > >
      > > and created a new virtual directory for it and make it point to the[/color]
      > project[color=green]
      > > Directory
      > >
      > > , till now every thing is ok,
      > >
      > > the problem is that Server.MapPath( "/") returns "c:\inetpub\www root" ???
      > >
      > > i dont know why, while it works fine on site
      > >
      > > i'm running IIS 5 on win2000 pro
      > >
      > > thanks,
      > >
      > > with my best regards
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Ray at

        #4
        Re: MapPath Strange behavior locally

        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.co m> wrote in message
        news:%23ZyKpJpN EHA.3672@TK2MSF TNGP11.phx.gbl. ..[color=blue]
        > 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:#1y4gGpNEH A.1956@TK2MSFTN GP10.phx.gbl...[color=green]
        > > That is expected behavior. / is the root of your site, regardless of[/color]
        > where[color=green]
        > > you are, so when that path is translated to the file system, it is where[/color]
        > the[color=green]
        > > root of your site is. This is C:\Inetpub\wwwr oot in a default
        > > configuration.
        > >
        > > ./ would work for you.
        > >
        > > Ray at work
        > >
        > > "Ahmed El Lakani" <a@hotmail.co m> wrote in message
        > > news:Ol1Bp8oNEH A.2704@TK2MSFTN GP10.phx.gbl...[color=darkred]
        > > > hi all,
        > > >
        > > > i've a legacy ASP.NTT code that works fine, but now i'm trying to add[/color][/color]
        > new[color=green][color=darkred]
        > > > feature
        > > >
        > > > so i get the files from our source safe and put them in[/color]
        > > "d:\Projects\my Site"[color=darkred]
        > > >
        > > > and created a new virtual directory for it and make it point to the[/color]
        > > project[color=darkred]
        > > > Directory
        > > >
        > > > , till now every thing is ok,
        > > >
        > > > the problem is that Server.MapPath( "/") returns "c:\inetpub\www root"[/color][/color][/color]
        ???[color=blue][color=green][color=darkred]
        > > >
        > > > i dont know why, while it works fine on site
        > > >
        > > > i'm running IIS 5 on win2000 pro
        > > >
        > > > thanks,
        > > >
        > > > with my best regards
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Ahmed El Lakani

          #5
          Re: MapPath Strange behavior locally

          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:e8RTZOpNEH A.1956@TK2MSFTN GP10.phx.gbl...[color=blue]
          > 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.co m> wrote in message
          > news:%23ZyKpJpN EHA.3672@TK2MSF TNGP11.phx.gbl. ..[color=green]
          > > Thanks Ray,
          > >
          > > mmmm, but how it was installed on hosting machine ????
          > > is this mean that its installed on the root ????, or some thing that[/color][/color]
          isn't[color=blue][color=green]
          > > avilable on win2000 pro
          > > if that, so how i'm going to change it to work on both sides ??? my pc[/color][/color]
          and[color=blue][color=green]
          > > the host ?
          > >
          > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
          > > message news:#1y4gGpNEH A.1956@TK2MSFTN GP10.phx.gbl...[color=darkred]
          > > > That is expected behavior. / is the root of your site, regardless of[/color]
          > > where[color=darkred]
          > > > you are, so when that path is translated to the file system, it is[/color][/color][/color]
          where[color=blue][color=green]
          > > the[color=darkred]
          > > > root of your site is. This is C:\Inetpub\wwwr oot in a default
          > > > configuration.
          > > >
          > > > ./ would work for you.
          > > >
          > > > Ray at work
          > > >
          > > > "Ahmed El Lakani" <a@hotmail.co m> wrote in message
          > > > news:Ol1Bp8oNEH A.2704@TK2MSFTN GP10.phx.gbl...
          > > > > hi all,
          > > > >
          > > > > i've a legacy ASP.NTT code that works fine, but now i'm trying to[/color][/color][/color]
          add[color=blue][color=green]
          > > new[color=darkred]
          > > > > feature
          > > > >
          > > > > so i get the files from our source safe and put them in
          > > > "d:\Projects\my Site"
          > > > >
          > > > > 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\www root"[/color][/color]
          > ???[color=green][color=darkred]
          > > > >
          > > > > i dont know why, while it works fine on site
          > > > >
          > > > > i'm running IIS 5 on win2000 pro
          > > > >
          > > > > thanks,
          > > > >
          > > > > with my best regards
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Patrice

            #6
            Re: MapPath Strange behavior locally

            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\externa l\yourname\your app and it can't be machine independant.

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

            Patrice

            "Ahmed El Lakani" <a@hotmail.co m> a écrit dans le message de
            news:%239QpxQpN EHA.3556@TK2MSF TNGP09.phx.gbl. ..[color=blue]
            > 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:e8RTZOpNEH A.1956@TK2MSFTN GP10.phx.gbl...[color=green]
            > > 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.co m> wrote in message
            > > news:%23ZyKpJpN EHA.3672@TK2MSF TNGP11.phx.gbl. ..[color=darkred]
            > > > Thanks Ray,
            > > >
            > > > mmmm, but how it was installed on hosting machine ????
            > > > is this mean that its installed on the root ????, or some thing that[/color][/color]
            > isn't[color=green][color=darkred]
            > > > avilable on win2000 pro
            > > > if that, so how i'm going to change it to work on both sides ??? my pc[/color][/color]
            > and[color=green][color=darkred]
            > > > the host ?
            > > >
            > > > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> wrote in
            > > > message news:#1y4gGpNEH A.1956@TK2MSFTN GP10.phx.gbl...
            > > > > That is expected behavior. / is the root of your site, regardless[/color][/color][/color]
            of[color=blue][color=green][color=darkred]
            > > > where
            > > > > you are, so when that path is translated to the file system, it is[/color][/color]
            > where[color=green][color=darkred]
            > > > the
            > > > > root of your site is. This is C:\Inetpub\wwwr oot in a default
            > > > > configuration.
            > > > >
            > > > > ./ would work for you.
            > > > >
            > > > > Ray at work
            > > > >
            > > > > "Ahmed El Lakani" <a@hotmail.co m> wrote in message
            > > > > news:Ol1Bp8oNEH A.2704@TK2MSFTN GP10.phx.gbl...
            > > > > > hi all,
            > > > > >
            > > > > > i've a legacy ASP.NTT code that works fine, but now i'm trying to[/color][/color]
            > add[color=green][color=darkred]
            > > > new
            > > > > > feature
            > > > > >
            > > > > > so i get the files from our source safe and put them in
            > > > > "d:\Projects\my Site"
            > > > > >
            > > > > > and created a new virtual directory for it and make it point to[/color][/color][/color]
            the[color=blue][color=green][color=darkred]
            > > > > project
            > > > > > Directory
            > > > > >
            > > > > > , till now every thing is ok,
            > > > > >
            > > > > > the problem is that Server.MapPath( "/") returns[/color][/color][/color]
            "c:\inetpub\www root"[color=blue][color=green]
            > > ???[color=darkred]
            > > > > >
            > > > > > i dont know why, while it works fine on site
            > > > > >
            > > > > > i'm running IIS 5 on win2000 pro
            > > > > >
            > > > > > thanks,
            > > > > >
            > > > > > with my best regards
            > > > > >
            > > > > >
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...