在文本框中允许HTML [英] Allow HTML in text boxes

查看:43
本文介绍了在文本框中允许HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ASP.NET MVC.

I'm using ASP.NET MVC.

如何允许用户在文本框中输入HTML? 我将validaterequest设置为false并仍然收到此错误:

How can I allow users to enter HTML into a textbox? I'm seting validaterequest to false and still getting this error:

从客户端检测到一个潜在危险的Request.Form值(Summary ="<a>").

我知道不推荐使用它,但仅供内部使用.

I know its not recommended etc, but it's for internal use.

推荐答案

在操作中添加ValidateInput(false)属性

[ValidateInput(false)]
public ActionResult MyAction (int id, string content) {
}

这篇关于在文本框中允许HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆