Server.MapPath() localhost

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • withers

    Server.MapPath() localhost

    If I run Server.MapPath( "/") on my operational Internet server I get,
    correctly, the physical path to the directory my page is in (d:\....
    \...\htdocs).

    If I run Server.MapPath( "/") on my intranet server, my localhost, I
    get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
    are in c:\webtest.

    How to I establish the correct physical root on my intranet server?

    Thanking you in anticipation.

  • TOUDIdel

    #2
    Re: Server.MapPath( ) localhost


    Uzytkownik "withers" <roger@upperbri dge.co.uknapisa l w wiadomosci
    news:e0fbaa25-cdf6-44e4-aa0e-f18218b83305@34 g2000hsz.google groups.com...
    If I run Server.MapPath( "/") on my operational Internet server I get,
    correctly, the physical path to the directory my page is in (d:\....
    \...\htdocs).
    >
    If I run Server.MapPath( "/") on my intranet server, my localhost, I
    get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
    are in c:\webtest.
    >
    How to I establish the correct physical root on my intranet server?
    c:\inetpub\wwwr oot is probably correct physical path in that case. Check in
    your IIS configuration console what exactly indicates wwwroot path and
    change to proper if need.
    --
    td


    Comment

    • withers

      #3
      Re: Server.MapPath( ) localhost

      On Feb 26, 8:13 am, "TOUDIdel" <toudi...@oDWA. plwrote:
      Uzytkownik "withers" <ro...@upperbri dge.co.uknapisa l w wiadomoscinews: e0fbaa25-cdf6-44e4-aa0e-f18218b83305@34 g2000hsz.google groups.com...
      >
      If I run Server.MapPath( "/") on my operational Internet server I get,
      correctly, the physical path to the directory my page is in (d:\....
      \...\htdocs).
      >
      If I run Server.MapPath( "/") on my intranet server, my localhost, I
      get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
      are in c:\webtest.
      >
      How to I establish the correct physical root on my intranet server?
      >
      c:\inetpub\wwwr oot is probably correct physical path in that case. Check in
      your IIS configuration console what exactly indicates wwwroot path and
      change to proper if need.
      --
      td
      All my websites are in a folder c:\WebTest on my local host. For
      example, the files for Web1.com are in c:\WebTest\Web1 .com.

      If I look at the properties of Web1.com, on the Home Directory tab the
      local path is set to c:\WebTexs\Web1 .com.

      If I run Server.MapPath( "/") from a page in Web1.com, the result is c:
      \inetpub\wwwroo t.

      In IIS, all the virtual directories are in a folder Default Web Site.
      The properties of this show a local path of c:\inetpub\wwwr oot.
      Server.MapPath( "/") will always resolve to the local path I set in
      Default Web Site properties.

      I want Server.MapPath( "/") to resolve to the website that runs this
      command, in my example, resolve to c:\WebTest\Web1 .com.

      How do I set up IIS so that Server.MapPath uses the local path of the
      website rather than the local path of the Default Web Site
      properities?

      I have noticed on my operation server in the internet, the local path
      setting in Default Web Site properties is greyed out. Server.MapPath
      gives the correct answer on this server.

      Thanking you in anticipation.

      Comment

      • Anthony Jones

        #4
        Re: Server.MapPath( ) localhost

        "withers" <roger@upperbri dge.co.ukwrote in message
        news:e0fbaa25-cdf6-44e4-aa0e-f18218b83305@34 g2000hsz.google groups.com...
        If I run Server.MapPath( "/") on my operational Internet server I get,
        correctly, the physical path to the directory my page is in (d:\....
        \...\htdocs).
        >
        If I run Server.MapPath( "/") on my intranet server, my localhost, I
        get c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they
        are in c:\webtest.
        >
        How to I establish the correct physical root on my intranet server?
        >

        Your local host is XP? Do really have multiple websites on the local host
        or do you in fact simply have one the Default Web Site under which you've
        created one or more virtual directories enabled as applications?

        I think what you really need is this:-

        sPath = Request.ServerV ariables("APPL_ PHYSICAL_PATH")


        --
        Anthony Jones - MVP ASP/ASP.NET


        Comment

        • Daniel Crichton

          #5
          Re: Server.MapPath( ) localhost

          withers wrote on Mon, 25 Feb 2008 16:17:53 -0800 (PST):
          If I run Server.MapPath( "/") on my operational Internet server I get,
          correctly, the physical path to the directory my page is in (d:\....
          \...\htdocs).
          If I run Server.MapPath( "/") on my intranet server, my localhost, I get
          c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they are in
          c:\webtest.
          How to I establish the correct physical root on my intranet server?
          Thanking you in anticipation.

          Server.MapPath( "/") returns the physical root for the site. If you need the
          physical location for a virtual dir, try Server.MapPath( "./") instead.

          --
          Dan


          Comment

          • withers

            #6
            Re: Server.MapPath( ) localhost

            On Feb 26, 12:55 pm, "Daniel Crichton" <msn...@worldof spack.com>
            wrote:
            withers wrote  on Mon, 25 Feb 2008 16:17:53 -0800 (PST):
            >
            If I run Server.MapPath( "/") on my operational Internet server I get,
            correctly, the physical path to the directory my page is in (d:\....
            \...\htdocs).
            If I run Server.MapPath( "/") on my intranet server, my localhost, I get
            c:\inetpub\wwwr oot, but my webpages are NOT in this folder, they are in
            c:\webtest.
            How to I establish the correct physical root on my intranet server?
            Thanking you in anticipation.
            >
            Server.MapPath( "/") returns the physical root for the site. If you need the
            physical location for a virtual dir, try Server.MapPath( "./") instead.
            >
            --
            Dan
            Many thanks for your help, Anthony and Dan.

            Spoilt for choice! Request.ServerV ariables("APPL_ PHYSICAL_PATH") or
            Server.MapPath( "./").

            Does it matter which I use?

            Comment

            • Anthony Jones

              #7
              Re: Server.MapPath( ) localhost

              "withers" <roger@upperbri dge.co.ukwrote in message
              news:eba7fa51-ad03-4935-9d0a-991ec4570140@e2 3g2000prf.googl egroups.com...
              On Feb 26, 12:55 pm, "Daniel Crichton" <msn...@worldof spack.com>
              wrote:
              withers wrote on Mon, 25 Feb 2008 16:17:53 -0800 (PST):
              >
              >Many thanks for your help, Anthony and Dan.
              >
              >Spoilt for choice! Request.ServerV ariables("APPL_ PHYSICAL_PATH") or
              >Server.MapPath ("./").
              >
              >Does it matter which I use?
              I haven't actually tested it but it seems to me that Server.MapPath( "./")
              will return the physical folder that the current ASP page is found in. This
              is not necesarily the same as the application physical path. If the page
              executing the code is in a sub-folder with in the application folder the two
              will return different results. So it depends on what you really want. The
              current folder the ASP pages is running in or the root folder of the
              application.

              --
              Anthony Jones - MVP ASP/ASP.NET


              Comment

              Working...