[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I submit HTML from a text box

Posted on 2009-04-16
2
Medium Priority
?
231 Views
Last Modified: 2012-05-06
Hi There
I have a multiline textbox that I am want to use to save html in the db that will be diplayed later as a divs innerhtml.

When I submit my for I get a ASP.Net error saying that potetially usafe content has been submitted.

How do I save html as not to get this message.

// Insert code
 
   SkinMan.Code =txtCode.Text;//failing here
   m_contentManager.SaveSkins(SkinMan);
 
//display code
 dvLinks.InnerHtml = skinman.Code;

Open in new window

0
Comment
Question by:Stanton_Roux
  • 2
2 Comments
 
LVL 15

Expert Comment

by:spprivate
ID: 24157866
This is a security feature to prevent cross site script attack

http://tldp.org/HOWTO/Secure-Programs-HOWTO/cross-site-malicious-content.html
You need to use htmlencoding in asp.net to prevent this message
0
 
LVL 15

Accepted Solution

by:
spprivate earned 2000 total points
ID: 24157885
You can  set the Page ValidateRequest="false" and use HttpUtility.HtmlEncode() if you want to supress this message
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Loops Section Overview
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

834 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