473,748 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

apostrophe in href path

Hi all,

I'm trying to create a clickable link, but the pesky apostrophe is
preventing the link from getting displayed properly. I'm displaying the
contents of a folder (with contains the apostrophe), with the filename as a
clickable link. The files show up properly, but the link location cuts off at
the apostrophe.

Here's a code snippet (fi is an instance of FileInfo):

string fileList = "";

fileList = ("<a href='" + strFolderNameWi thApos + "\\" + fi.Name + "'>" +
fi.Name + "</a>");

labelText.Text = fileList;

I've tried replacing the apostrophe with
a double apostrophe
%27
'
&apos;

but because of the href=' ....' it interprets it literally. Other than
renaming the folder without an apostrophe, is there a way around this?

Thanks in advance.
Mar 31 '06 #1
1 4023
HttpServerUtili ty.UrlEncode is your answer.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Rose" <Ro**@discussio ns.microsoft.co m> wrote in message
news:B8******** *************** ***********@mic rosoft.com...
Hi all,

I'm trying to create a clickable link, but the pesky apostrophe is
preventing the link from getting displayed properly. I'm displaying the
contents of a folder (with contains the apostrophe), with the filename as
a
clickable link. The files show up properly, but the link location cuts off
at
the apostrophe.

Here's a code snippet (fi is an instance of FileInfo):

string fileList = "";

fileList = ("<a href='" + strFolderNameWi thApos + "\\" + fi.Name + "'>" +
fi.Name + "</a>");

labelText.Text = fileList;

I've tried replacing the apostrophe with
a double apostrophe
%27
'
&apos;

but because of the href=' ....' it interprets it literally. Other than
renaming the folder without an apostrophe, is there a way around this?

Thanks in advance.

Mar 31 '06 #2

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

Similar topics

2
1649
by: InvisibleMan | last post by:
Thank in advance for your help... I have the following javascript: document.write(' <a class="whitenav" href="javascript:window.external.AddFavorite ('http://www.mydomain.com','Welcome to MyDomain.com')">Bookmark Site</a> |'); where the problem arises with the apostrophe's in:
13
11439
by: Richard Hollenbeck | last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to forbid an apostrophe from being entered into a text field? For example, couldn't "Alice's Restaurant" be changed to "Alices Restaurant" etc. automatically and programmatically during data entry? This would eliminate my concatinated strings from producing errors when I base the string on a query. Think this is an example of the "Dreaded Apostrophe Bug." If I enter a...
14
3761
by: Adnan Siddiqi | last post by:
Hi Suppose I have following URLs comming from an HTML document <a href="http://mydomain1.com">Domain1</a> <a href="http://subdomain.domain.com/myfile.anyext">http://subdomain.domain.com/myfile.anyext</a> <a href="http://subdomain.domain2.com/myfile.anyext">Domain2</a>
1
2952
by: tim.landgraf | last post by:
hi there, i am experiencing a strange problem. i am iterating through a given directory, selecting only jpg - images that are then resized and inserted into a database. everything works, but if there is a file with an apostrophe in it the GD function @ImageCreateFromJPEG fails. anyone knows this problem and possible workarounds? thank you, tim
5
1899
by: =?Utf-8?B?TEtOZXdzR3JvdXBz?= | last post by:
Hi I have a list which pulls out items from a stored procedure. Unfortunately some of the items it pulls out have apostrophes. This info need to be placed in a URL but it keeps truncating at the apostrophe. When there is no apostrophe all is well. Example With no apostrophe String = accessories No problem subcategory.aspx?strSubCategory=Accessories&CategoryID=5
1
3399
by: infodemers | last post by:
Hi everyone, I have the following code: <asp:TemplateField> <ItemTemplate> <a href="javascript:openPopup('Info.aspx?id=<%# Eval("strresultats") %>')"> <img alt='<%# Eval("strresultats") %>' src="Info.png" style="border: 0px; width: 32px;" /></a> ...
9
3596
by: Thomas 'PointedEars' Lahn | last post by:
Jukka K. Korpela wrote: IBTD. For example, in English it is customary (and AIUI expected) to use the character that ’ represents should be used to delimit a quotation within direct speech (which itself should be delimited by “ and ”. (I gathered that from reading several English books.) I think you would agree that it would make especially English text with quotations in direct speech (say, in a novel where one person tells another...
4
2160
by: viki1967 | last post by:
Hi all. I have problem with this code javascript: <input type="submit" name="Submit" value="Go" onclick="if(confirm('Confirm?')) location.href='page.asp?DES=Try after 1' minute'; return false;"></a> If delete the apostrophe in the string "Try after 1' minute" the page working:
2
2491
by: tasteofchaos | last post by:
Hey guys, Small problem... On my site: <Link removed> Apostrophes stop any more text after it showing in link titles.
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.