473,480 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Having & in folder name

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

Aug 24 '07 #1
2 1180
David C wrote:
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))

--

Riki
Aug 24 '07 #2
Thanks. That worked!
"Riki" <ri**@dontnagme.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
David C wrote:
>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 &amp; 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))

--

Riki

Aug 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
5638
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
1
3702
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
18
2883
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
1
2920
by: normd | last post by:
I have a text file which contains VB.NET code. The VB.NET code is actually a Class that can contain code, which simply displays a message box or does something more complicated (i.e Excel/Word...
1
10392
by: siddharth_jain_1 | last post by:
Hello I am trying to get a list of shared files and subdirectories in a particular folder on a server. For this I am using DirectoryInfo in the following way. DirectoryInfo folder = new...
1
2907
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand...
7
1778
by: Kirt | last post by:
i have walked a directory and have written the foll xml document. one of the folder had "&" character so i replaced it by "&amp;" #------------------test1.xml <Directory> <dirname>C:\Documents and...
5
4602
Chrisjc
by: Chrisjc | last post by:
Good afternoon, I am seeking some php configuration help. Here is the run down I am running Windows server 2003 and IIS V6.0 I have never had issues before until now. I have Symantec Antivirus 11.0...
0
2102
by: OldBirdman | last post by:
This used to work, but now it doesn't. From the Desktop, trying to click the folder in Microsoft Windows Network From the Laptop, again trying to click the folder in Network Clicking...
0
7044
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7087
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.