Having & in folder name

D

David C

I am getting the following error trying to display a file in a web page.

Source: mscorlib

An unhandled exception occurred:

Message: Could not find a part of the path 'D:\Listings\Hartwig Blvd -
475\Maps & Floor Plans\GenerateThumbnail.txt'.


I assume it has something to do with the fact that one of the subfolder
names is "Maps & Floor Plans". The & is valid in a folder name so how can I
avoid this error? I am simply trying to do this and it fails on WriteFile
method:

Response.ContentType = "text/plain"

Response.WriteFile(FilePath)



David
 
R

Riki

David said:
I am getting the following error trying to display a file in a web
page.
Source: mscorlib

An unhandled exception occurred:

Message: Could not find a part of the path 'D:\Listings\Hartwig Blvd -
475\Maps & Floor Plans\GenerateThumbnail.txt'.


I assume it has something to do with the fact that one of the
subfolder names is "Maps & Floor Plans". The & is valid in a folder
name so how can I avoid this error? I am simply trying to do this
and it fails on WriteFile method:

Response.ContentType = "text/plain"

Response.WriteFile(FilePath)

It seems that your filepath is HTML encoded.

So, just decode it:
Response.WriteFile(Server.HtmlDecode(FilePath))
 

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,774
Messages
2,569,596
Members
45,142
Latest member
DewittMill
Top