【发布时间】:2014-07-07 17:53:55
【问题描述】:
我不断收到一条错误消息,提示“从客户端检测到具有潜在危险的 Request.Form 值”。这是因为我在字符串中有 html 样式标签,用于在文本区域中显示字符串。我需要一种方法来关闭此项目的验证,因为它一直显示潜在危险页面。我找到了一些其他来源,但我还没有取得任何成功。
我试过了:
1.) 在 Action 顶部添加 [ValidationInput(false)],我仍然看到可能有害的页面。
2.) 在 Web.config 中添加 <pages validateRequest="false"></pages> 和 <httpruntime requestValidationMode = "2.0"></httpruntime>,但我遇到了 HTTP 错误 500.19 - 内部服务器错误。 <pages validateRequest="false"></pages>上的错误
有什么办法可以解决这个错误吗?
这是我的模型:
public partial class AP_Tasks
{
public int TaskID { get; set; }
public Nullable<System.DateTime> TaskDate { get; set; }
public string TaskType { get; set; }
public string AssignedBy { get; set; }
public string AssignedTo { get; set; }
public string CC { get; set; }
public string Whse { get; set; }
public string PO { get; set; }
public string FreightNo { get; set; }
public string VendName { get; set; }
public Nullable<System.DateTime> ReqCompDate { get; set; }
public Nullable<System.DateTime> DueDate { get; set; }
public Nullable<System.DateTime> CompDate { get; set; }
public string Notes { get; set; }
public Nullable<System.DateTime> InvDate { get; set; }
public Nullable<int> CoNo { get; set; }
public Nullable<int> NoteCnt { get; set; }
}
我相信笔记是问题所在。它是包含 HTML 标记的字符串。
【问题讨论】:
-
505错误是什么? -
对不起,这是 500.19 错误。我改变了我的帖子
-
来自second answer here =>
What about [AllowHtml] attribute above property? -
是的,您只需在属性中添加
[AllowHtml]。 -
谢谢你们。你能回答我可以标记吗?
标签: c# html asp.net-mvc razor