views:

195

answers:

2

I'm getting the "Potentially dangerous Request.Form request value was detected from the client" exception when im using my FCK editor.

How could encode before submit the form, or disable this validation without disable the Data Anotations validation?

This is the code of my view:

 <% 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>

Thanks a lot in advance.

+3  A: 

<httpRuntime requestValidationMode="2.0" />

Check: http://stackoverflow.com/questions/1648386/request-validation-asp-net-mvc-2

jorgebg
A: 

config.htmlEncodeOutput

But it might be easier to use a .Net wrapper for CKEditor.

AlfonsoML