How do I submit HTML from a text box

Posted on 2009-04-16
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


//display code

 dvLinks.InnerHtml = skinman.Code;

Open in new window

Question by:Stanton_Roux
    LVL 15

    Expert Comment

    This is a security feature to prevent cross site script attack
    You need to use htmlencoding in to prevent this message
    LVL 15

    Accepted Solution

    You can  set the Page ValidateRequest="false" and use HttpUtility.HtmlEncode() if you want to supress this message

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now