failed to map the path error message when folder name containsampersand (&)

Discussion in 'ASP .Net' started by Mel, Sep 10, 2010.

  1. Mel

    Mel Guest

    When my folder name contains an ampersand Server.MapPath returns the
    following error. How do I get it to work?
    Error: "Failed to map the path '/MyWeb/DOCS/HIGH SCHOOL ADD. & RENOV./
    UPLOAD DOCS/'."

    Here is my code:
    Dim strProjFolder as String = "~/DOCS/HIGH SCHOOL ADD. & RENOV."
    Dim dirInfo As New DirectoryInfo(Server.MapPath(strProjFolder & "/
    UPLOAD DOCS/"))
     
    Mel, Sep 10, 2010
    #1
    1. Advertising

  2. Mel

    Mel Guest

    On Sep 10, 10:12 am, Mel <> wrote:
    > When my folder name contains an ampersand Server.MapPath returns the
    > following error.  How do I get it to work?
    > Error: "Failed to map the path '/MyWeb/DOCS/HIGH SCHOOL ADD. & RENOV./
    > UPLOAD DOCS/'."
    >
    > Here is my code:
    > Dim strProjFolder as String = "~/DOCS/HIGH SCHOOL ADD. & RENOV."
    > Dim dirInfo As New DirectoryInfo(Server.MapPath(strProjFolder & "/
    > UPLOAD DOCS/"))


    I resolved the issue. It has nothing to do with the ampersand.
    Folder names cannot end with a period. When I strip off the period
    from the end of strProjFolder string and perform the server.mappath it
    works.
     
    Mel, Sep 10, 2010
    #2
    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. Jonas Auken
    Replies:
    1
    Views:
    1,775
    Steven Cheng[MSFT]
    Oct 12, 2004
  2. =?Utf-8?B?cmFuZHkgY29sbGlucw==?=

    ASP.NET 2.0: "hello world" page fails with "Failed to map the path

    =?Utf-8?B?cmFuZHkgY29sbGlucw==?=, Apr 15, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    5,577
    eagle1140
    Apr 13, 2011
  3. Replies:
    0
    Views:
    2,250
  4. =?Utf-8?B?QW5kZXJzIEJvcm5ob2xt?=

    ASP.NET app initialization problem (Failed to map the path)

    =?Utf-8?B?QW5kZXJzIEJvcm5ob2xt?=, Oct 14, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,201
    George
    Oct 17, 2005
  5. =?Utf-8?B?QWRhbQ==?=

    Failed to map the path '/App_GlobalResources/'

    =?Utf-8?B?QWRhbQ==?=, Nov 9, 2005, in forum: ASP .Net
    Replies:
    13
    Views:
    3,732
    Steven Cheng[MSFT]
    Nov 14, 2005
Loading...

Share This Page