473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Why does a Label control *not* UrlEncode its Text?


Can anyone tell me the logical reason for the above. I've read the
documentation and made note of the fact that the Label might be used to
display user input, which might be malicious script etc, but I'd like to
know why the content isn't UrlEncoded for a Label control?

If one wants unencoded strings, shouldn't one be using LiteralControl
instead?

Jan 25 '06 #1
3 1153
Correction. I meant HtmlEncode.

"Kevin Frey" <ke**********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...

Can anyone tell me the logical reason for the above. I've read the
documentation and made note of the fact that the Label might be used to
display user input, which might be malicious script etc, but I'd like to
know why the content isn't UrlEncoded for a Label control?

If one wants unencoded strings, shouldn't one be using LiteralControl
instead?

Jan 25 '06 #2
Kevin Frey wrote:
Correction. I meant HtmlEncode.

"Kevin Frey" <ke**********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Can anyone tell me the logical reason for the above. I've read the
documentation and made note of the fact that the Label might be used to
display user input, which might be malicious script etc, but I'd like to
know why the content isn't UrlEncoded for a Label control?

If one wants unencoded strings, shouldn't one be using LiteralControl
instead?


Short answer, the ASP.NET tags render as normal HTML controls (that your
web browser understands hence displays). These controls (text, textarea,
etc) pass plain text (it's the browser's behavior). It's been like that
since day 1. I don't see why they should/would HtmlEncode the text
either (and when you need it to, it's just a short string).
Jan 25 '06 #3
Broadest feature. As it is rendered it is legal to assingn HTML code to a
label. Encoding would have prevent to do something that is legal and would
have forced to use another soltuion.

As a side note, ASP..NET prevents to submit HTML tags in form fields by
default...

---
Patrice

"Kevin Frey" <ke**********@hotmail.com> a écrit dans le message de
news:%2***************@TK2MSFTNGP12.phx.gbl...

Can anyone tell me the logical reason for the above. I've read the
documentation and made note of the fact that the Label might be used to
display user input, which might be malicious script etc, but I'd like to
know why the content isn't UrlEncoded for a Label control?

If one wants unencoded strings, shouldn't one be using LiteralControl
instead?

Jan 25 '06 #4

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

Similar topics

4
by: Rob Lykens | last post by:
I am wondering if anyone has done something like this? I want to find a label based on the passed in information. It would be awesome to find something like this: private void myvoid (int i) {...
5
by: tindog | last post by:
I seem to be caught in a bit of a conundrum with C#. First of all getting books on VS 2003.net then VS 2005 comes out and further a book I have bought to just learn just the language C# (in 21...
2
by: Benedict Teoh | last post by:
I created a dropdownlist containing day, month and year field and expose a property to assign a date. When I call from a aspx page and assign the value, the new date is not displayed until a submit...
2
by: Joey | last post by:
Hi There, I am trying to get the selected value of a listbox when I click a button, everything works ok and I can bind the list and when I have a basic page and click a button to invoke a sub it...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
2
by: Jim Carr | last post by:
Upon entering the site www.FutureByDesign-Music.com with IE6, my clipboard is erased and then disabled in all other Windows XP applications. Navigating to another site returns clipboard...
71
by: active | last post by:
In the main program I check to see if a certain form has been disposed. Does it make sense in that form's FormClosed event to do: Me.Dispose to make sure it is disposed the next time I check. Or...
6
by: Dmitry Duginov | last post by:
Hi, I have the following label markup (label is inside FormView): <asp:Label ID="lblIndicatorReady" runat="server" Text="RE" ToolTip="Ready" BackColor='<%#...
11
by: Peter Larsen [] | last post by:
Hi, I have two questions related to the Label control. How do i prevent the label from expand the canvas into 2 lines (word wrap) ?? At the moment i set AutoSize to false (to prevent the word...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...
0
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...
0
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...

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.