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

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/"))
 
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/"))

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top