Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 字符串包含html标记的验证错误-MVC_C#_Html_Asp.net Mvc_Razor - Fatal编程技术网

C# 字符串包含html标记的验证错误-MVC

C# 字符串包含html标记的验证错误-MVC,c#,html,asp.net-mvc,razor,C#,Html,Asp.net Mvc,Razor,我不断收到一个错误,上面写着“一个潜在危险的请求。从客户端检测到表单值”。这是因为我在字符串中有html样式标记,用于在文本区域中显示字符串。我需要一种方法来关闭此项的验证,因为它会一直显示潜在危险的页面。我已经找到了一些其他来源,但我还没有取得任何成功 我试过: 1.)在操作的顶部添加[validationput(false)],我仍然可以看到可能有害的页面 2.)在Web.config中添加和,但我得到一个HTTP错误500.19-内部服务器错误。在 有没有办法克服这个错误 这是我的模型:

我不断收到一个错误,上面写着“一个潜在危险的请求。从客户端检测到表单值”。这是因为我在字符串中有html样式标记,用于在文本区域中显示字符串。我需要一种方法来关闭此项的验证,因为它会一直显示潜在危险的页面。我已经找到了一些其他来源,但我还没有取得任何成功

我试过:

1.)在操作的顶部添加
[validationput(false)]
,我仍然可以看到可能有害的页面

2.)在Web.config中添加
,但我得到一个HTTP错误500.19-内部服务器错误。在

有没有办法克服这个错误

这是我的模型:

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; }
    }
公共部分类AP\U任务
{
public int TaskID{get;set;}
公共可为空的TaskDate{get;set;}
公共字符串TaskType{get;set;}
由{get;set;}分配的公共字符串
分配给{get;set;}的公共字符串
公共字符串CC{get;set;}
公共字符串Whse{get;set;}
公共字符串PO{get;set;}
公共字符串FreightNo{get;set;}
公共字符串名称{get;set;}
公共可为空的ReqCompDate{get;set;}
公共可为空的DueDate{get;set;}
公共可空CompDate{get;set;}
公共字符串注释{get;set;}
公共可空InvDate{get;set;}
公共可为空的CoNo{get;set;}
公共可空NoteCnt{get;set;}
}

我相信笔记就是问题所在。它是包含HTML标记的字符串。

通过[]属性在属性级别设置它。

什么是
505
错误?抱歉,是500.19错误。我更改了属性上方的“=>
关于[allowtml]的属性如何?
是的,您只需要将
[allowtml]
添加到属性中。谢谢大家。你能回答我的问题吗?我能做标记吗?