gpt4 book ai didi

asp.net-mvc-2 - 检测到有潜在危险的 request.form 值但 validateinput(false) 不起作用

转载 作者:行者123 更新时间:2023-12-04 21:54:53 25 4
gpt4 key购买 nike

我已经安装了 VS2010 和 MVC2 并使用 tinyMCE 测试了一个简单的表单。当我在 tinyMCE 中发布 textarea 的内容时,我收到了可怕的 YSD 和消息

"a potentially dangerous....."



我以前见过这个,所以我把 ValidateInput(false)在 Controller 上但没有快乐 - 我仍然收到错误消息。

edit.aspx 中的页面代码是:
    <% using (Html.BeginForm()){ %>

<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
<textarea id="elm1" name="mceText" rows="15" cols="80" style="width: 80%">
&lt;p&gt;
This is some example text that you can edit inside the
&lt;strong&gt; TinyMCE editor&lt;/strong&gt;.
</textarea>

<br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
<%} %>

和 Controller Action 是:
    [AcceptVerbs(HttpVerbs.Post)]
[ValidateInput(false)]
public ActionResult Edit(string mceText)
{

return View();
}

任何想法 - (我知道代码不完整)已经尝试了几个小时,但每个人都只是说使用 ValidateInput(false)

最佳答案

更好的解决方案可能是使用 tinymce 编码选项:

http://www.tinymce.com/wiki.php/Configuration:encoding

tinyMCE.init({
...
encoding : "xml"
});

然后根据需要使用 HttpUtility.HtmlDecode 对其进行解码。

看这里 http://blog.tentaclesoftware.com/archive/2010/07/22/96.aspx

关于asp.net-mvc-2 - 检测到有潜在危险的 request.form 值但 validateinput(false) 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2473972/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com