Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Value cannot be null.\r\nParameter name: input

Tags:

c#

asp.net-mvc

I am getting an error of null value in the following code in MVC asp.net;

  @Regex.Replace(Model.FullDescription, "<[^>]*>" ,"")

I am trying to replace any HTML tag with empty string. In popup window it shows result correctly without HTML tags, but on page it is showing above null value error.

like image 343
trighati Avatar asked Aug 12 '16 06:08

trighati


1 Answers

You are passing it a null as its first parameter and it tells you in error message:

Value cannot be null.
Parameter name: input

Try to check it on error with null validation

@Regex.Replace(Model.FullDescription ?? "", "<[^>]*>" ,"")
like image 92
Roman Marusyk Avatar answered Oct 29 '22 23:10

Roman Marusyk