Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

retaining html input in textbox...

Posted on 2004-08-07
3
Medium Priority
?
384 Views
Last Modified: 2012-06-27
using a textarea in a form to capture user text entry that includes html code... when storing the text, the greater-than and less-than symbols are being replaced with their & equivalent codes. i tried server.htmlencode and htmldecode and not fixing it.

any ideas?
0
Comment
Question by:loyaliser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
AerosSaga earned 1000 total points
ID: 11744365
This is because the embeded html code could countain a malicious script to attempt to compromise your system.  ASP.NET recognizes this, the only way to leave the html intact is to disable validation for the whole page in the page directive.

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11744368
If you still want to turn off validation to retain the html see here for example:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconpage.asp

Regards,

Aeros
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11744510
here's a good article describing your options http://asp.net/faq/RequestValidation.aspx ...

this is exactly what you want to do ...

<%@ Page ValidateRequest="FALSE" language="C#" %>

<script runat="server">

void EnterBtn_Click(Object Src, EventArgs E) {
Message.Text = "Hi " + HttpUtility.HtmlEncode(Name.Text) + ", welcome to ASP.NET!";
}

</script>
<html>
<body>
<form runat=server>
Please enter your name: <asp:textbox id="Name" runat=server/>
<asp:button text="Enter" Onclick="EnterBtn_Click" runat=server/><br>
<asp:label id="Message" runat=server/>
</form>
</body>
</html>
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question