473,511 Members | 15,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML encoding method?

hello,

i need to do some HTML encoding on some strings. not UrlEncoding, mind
you, but HTML encoding. ie:

"&" to "&"
"<" to "&lt;"

....etc. does anyone know of a good way to do this, other than manual
string replacements? what of decoding back into plain text?
thanks,
matt

Feb 9 '07 #1
2 1088
HttpServerUtility.HtmlEncode() is what you're looking for. Here's MS
documentation on it:

http://msdn2.microsoft.com/en-gb/library/w3te6wfz.aspx

I just googled [.NET + HTMLEncode] and got over 200,000 links on this... the
above is just one of them

HTH

<ma**@mailinator.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
hello,

i need to do some HTML encoding on some strings. not UrlEncoding, mind
you, but HTML encoding. ie:

"&" to "&amp;"
"<" to "&lt;"

...etc. does anyone know of a good way to do this, other than manual
string replacements? what of decoding back into plain text?
thanks,
matt

Feb 9 '07 #2
On Feb 9, 2:20 pm, "Bob Johnson" <A...@B.comwrote:
HttpServerUtility.HtmlEncode() is what you're looking for. Here's MS
documentation on it:
ah sweet, thanks.
I just googled [.NET + HTMLEncode] and got over 200,000 links on this... the
above is just one of them
....i had tried some other keyword variations, didnt come up w/ the
MSDN result; but sure enough thats the documentation i needed.
thanks
matt

Feb 9 '07 #3

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

Similar topics

2
3179
by: Damien | last post by:
Hi to all, After hours of attempts and "googling", I'm still pulling my hair off my head when I try to send multipart html emails. It "works" on PCs with Outlook when I juste send a single...
3
2278
by: Marek | last post by:
Hi What I need to do is to take the following XML (or some variant of it): <?xml version="1.0" encoding="UTF-8"?> <MyRawHTML> <H1>Hello, world!</H1> </MyRawHTML> And apply an XSLT to it along...
5
2794
by: Steven Berkovitz | last post by:
Hi there, I am having a problem where if i add an attribute to a control at runtime the rendered attribute is HTML encoded. For example, on a textbox: textBox.Attributes = "if(x && y)...
7
4245
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant"...
0
1226
by: icoba | last post by:
Hi, I am parsing html documents using the html parser from libxml2, and if the encoding is included in the document it works perfectly but if it is not, I think it does not work well (probably...
7
2771
by: KelsMckin | last post by:
What is the easiest way to retreive the html source from a web page? Could you please provide an example? Any and all help would be greatly appreciated
14
5735
by: Zoro | last post by:
My task is to read html files from disk and save them onto SQL Server database field. I have created an nvarchar(max) field to hold them. The problem is that some characters, particularly html...
1
3199
by: Amie | last post by:
Hi, It seems asp.net controls automatically encode the attribute values. For example, I need to have whitespace in OPTION tag. After binding data to the dropdownlist, the source html has the...
2
2924
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am using ASP.Net 2.0 and VB.Net (although C#is ok also). I want to create an object/method/function that will take a URL as an input parameter and then return all of the HTML in that page. I...
5
12791
sid0404
by: sid0404 | last post by:
Hi I am new to the visualstudio.net I am trying to develop an application which requires me to send data to a HTML webpage - http://patft.uspto.gov/netahtml/PTO/search-bool.html and the user...
0
7245
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
7144
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...
0
7356
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,...
1
7085
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
7512
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
5671
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,...
1
5069
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...
0
4741
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...
0
3227
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...

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.