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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top