How can I use ckeditor/FCKeditor without affecting the default security of Asp.net?

Source: Internet
Author: User

By default, Asp.net does not allow the submission of HTMLSource codeTo a large extent, this prevents cross-site (COMMIT) attacks. However, Rich Text editors such as ckeditor and FCKeditor must generate HTML sources.Code, How to solve this conflict?

The general method is to modify web. config.

ASP. net2.0/3/3.5:

<PagesValidaterequest = "false"> </Pages>

In ASP. net4.0, this is not enough. It must be written as follows:

<Pages validaterequest = "false"> </pages>
<HttpruntimeRequestvalidationmode = "2.0"/>

This solution solves the problem, but also reduces security. How can we use ckeditor/FCKeditor without reducing the default security of Asp.net?

Ideas:
Add a hidden field to the client-form. When submitting a request, use URL encoding for the ckeditor/fck content, assign the value to the hidden field, clear ckeditor/fck, and submit the file, in this way, the submitted content does not contain the HTML source code.

Server-receives the value of this hidden domain as the content of the ckeditor, and decodes the URL before receiving it.

Code:

<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "default. aspx. cs" inherits = "ckeditor_demo.default" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml"> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.