Asp.net mvc 带有Ckeditor的MVC2应用程序;潜在危险的请求。表单
我在使用FCK编辑器时收到“潜在危险的请求。从客户端检测到表单请求值”异常 如何在提交表单之前进行编码,或者在不禁用数据验证的情况下禁用此验证 这是我的看法:Asp.net mvc 带有Ckeditor的MVC2应用程序;潜在危险的请求。表单,asp.net-mvc,ckeditor,fckeditor,Asp.net Mvc,Ckeditor,Fckeditor,我在使用FCK编辑器时收到“潜在危险的请求。从客户端检测到表单请求值”异常 如何在提交表单之前进行编码,或者在不禁用数据验证的情况下禁用此验证 这是我的看法: <% using (Html.BeginForm()) {%> <%: Html.ValidationSummary("Please complete in a right way the fields below.") %> <fieldset>
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary("Please complete in a right way the fields below.") %>
<fieldset>
<legend>Fields</legend>
<div class="editor-field">
<%: Html.LabelFor(e => e.Name)%>
<%: Html.TextBoxFor(e => e.Name)%>
<%: Html.ValidationMessageFor(e => e.Name)%>
</div>
<div class="editor-field">
<%: Html.LabelFor(e => e.Teaser) %>
<%: Html.TextAreaFor(e => e.Teaser)%>
<%: Html.ValidationMessageFor(e => e.Teaser)%>
</div>
<div class="editor-field">
<%: Html.LabelFor(e => e.Description) %>
<%: Html.TextAreaFor(e => e.Description)%>
<%: Html.ValidationMessageFor(e => e.Description)%>
</div>
<p>
<input type="submit" />
</p>
</fieldset>
<% } %>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="xxxxxx"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace("Description");
//]]>
</script>
领域
e、 名称)%%>
e、 名称)%%>
e、 名称)%%>
e、 挑逗者)%>
e、 挑逗者)%>
e、 挑逗者)%>
e、 说明)%>
e、 说明)%>
e、 说明)%>
//,或在
//window.onload事件处理程序。
//用一个编辑器替换
//实例,使用默认配置。
CKEDITOR.替换(“说明”);
//]]>
事先非常感谢。
检查:
但是使用脚本可能更容易。[script type=“text/javascript”src=“/ckeditor/\u source/core/editor.js”][/script]
CKEDITOR.config.htmlEncodeOutput=true 如果使用FCK编辑器或CKeditor,则不需要处理“requestValidationMode”。因为它将应用于整个应用程序。 您只需执行以下操作:
CKEDITOR.replace('Description', { toolbar: '1', htmlEncodeOutput: true});
然后在控制器中:
model.Body = System.Net.WebUtility.HtmlDecode(model.Body);
在这种情况下,如何处理需要请求验证的页面?