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

  • Thread starter Thread starter Mel
  • Start date Start date
M

Mel

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/"))
 
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.
 
Back
Top