[英]Value cannot be null.\r\nParameter name: input
I am getting an error of null
value in the following code in MVC asp.net
; 我在
MVC asp.net
的以下代码中收到null
值错误;
@Regex.Replace(Model.FullDescription, "<[^>]*>" ,"")
I am trying to replace any HTML
tag with empty string. 我正在尝试将任何
HTML
标记替换为空字符串。 In popup window it shows result correctly without HTML tags, but on page it is showing above null value error. 在弹出窗口中,它正确显示了没有HTML标记的结果,但是在页面上,它显示了空值错误以上。
You are passing it a null
as its first parameter and it tells you in error message: 您将其作为第一个参数传递给
null
,并在错误消息中告诉您:
Value cannot be null.
值不能为空。
Parameter name: input参数名称:输入
Try to check it on error with null validation 尝试使用null验证检查错误
@Regex.Replace(Model.FullDescription ?? "", "<[^>]*>" ,"")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.