urgent help needed, Server.MapPath() works differently on server than on development machine

Discussion in 'ASP .Net' started by Peter Row, Mar 1, 2004.

  1. Peter Row

    Peter Row Guest

    Hi,

    BACKGROUND:
    Win2K Server SP4, ASP.NET 1.1
    Win2K Pro SP4, ASP.NET 1.1
    I have a wrapper class around all the asp objects.

    Website physical directory structure (phoney names)
    Server:
    C:\MySite
    |_ _Settings
    |_ Root
    |_ Bin (contains the DLL)
    |_ XSL

    Development test machine
    C:\TestSite
    |_ _Settings
    |_ Root
    |_ Bin (contains the DLL)
    |_ XSL

    In both cases ParentPaths are enabled. In IIS the sites directory is set
    to C:\MySite\Root and
    C:\TestSite\Root respectively.

    I read in the settings file from the _Settings directory; working out the
    physical path with:

    Directory.GetParent(Asp.Server.MapPath("/")).FullName & "\"

    For some bizarre reason on the server this results in:
    C:\MySite\Root\_Settings

    ....but correctly on the development machine:
    C:\MySite\_Settings

    I have tried saying:
    Asp.Server.MapPath("~")
    .... instead, again, this works on the development machine but not on the
    server.

    The only difference as far as I can see is that the server site has it's own
    URL
    where as the development machine has a virtual root.

    This project is a port from a VB6/ASP app which worked fine with the same
    code
    as above.

    I think for some weird reason when running on the server it is somehow
    getting the
    "Bin" directory hence why the above is returned on the server. But I have
    tested
    it on my development machine against the compiled DLL and it still works
    even then.

    Any ideas as to what is going on would be most appreciated.

    Regards,
    Peter Row
     
    Peter Row, Mar 1, 2004
    #1
    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. Peter Row
    Replies:
    0
    Views:
    453
    Peter Row
    Feb 23, 2004
  2. Les Caudle
    Replies:
    2
    Views:
    1,738
    Les Caudle
    Sep 19, 2006
  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,202
    Juan T. Llibre
    Mar 11, 2007
  4. Replies:
    4
    Views:
    1,000
    Juan T. Llibre
    Oct 7, 2007
  5. Elie Grouchko
    Replies:
    7
    Views:
    295
    Elie Grouchko
    Jan 4, 2005
Loading...

Share This Page