"Failed to map the path '/'." exception in VB 2005

Last post 01-21-2007 2:46 PM by vivek_iit. 3 replies.

Sort Posts:

  • "Failed to map the path '/'." exception in VB 2005

    01-21-2007, 12:19 AM
    • Member
      100 point Member
    • fripper
    • Member since 11-11-2003, 11:53 PM
    • Posts 34

    I have a VB web app that I originally wrote using VS 2003 and am now converting to VB 2005.  The conversion seemed to go OK but when I run debug to test it I get an exception "Failed to map the path '/'." from the statement  PATH = Server.MapPath("..").  I cannot figure why this happens ... it works fine in VB 2003.  CAn someone enlighten me?  Thanks.

     

     

    fripper
  • Re: "Failed to map the path '/'." exception in VB 2005

    01-21-2007, 4:30 AM
    • All-Star
      17,710 point All-Star
    • vivek_iit
    • Member since 06-18-2006, 2:13 PM
    • New Delhi
    • Posts 3,171
    • TrustedFriends-MVPs

    Try using Server.MapPath("~") instead to get the root of the website and then access subfolders like: Server.MapPath("~/Folder1");

    HTH,

    Vivek

    CodeASP.NET Community

    Please mark the most helpful reply/replies as "Answer".
  • Re: "Failed to map the path '/'." exception in VB 2005

    01-21-2007, 12:16 PM
    • Member
      100 point Member
    • fripper
    • Member since 11-11-2003, 11:53 PM
    • Posts 34

     

    Thanks Vivek ... but I have one problem.  Server.MapPath("~") does (as you siggest) give me the root of the website but the folder I am after is the folder that CONTAINS the root of the website ... that is I want to go back one folder.  I suppose I can take what Server.MapPath("~") gives me and parse it to find the last "/" but that seems awkward ... there is probably a better way.   Thanks for your help.;

     

     

     

    fripper
  • Re: "Failed to map the path '/'." exception in VB 2005

    01-21-2007, 2:46 PM
    • All-Star
      17,710 point All-Star
    • vivek_iit
    • Member since 06-18-2006, 2:13 PM
    • New Delhi
    • Posts 3,171
    • TrustedFriends-MVPs

    You can use Request objects path related methods if Server.MapPath doesnt suit your needs. Check this blog for details:

    http://west-wind.com/weblog/posts/269.aspx

    Hope this helps,

    Vivek

    CodeASP.NET Community

    Please mark the most helpful reply/replies as "Answer".
Page 1 of 1 (4 items)