Abdul
Abdul

Reputation: 1476

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

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.

Upvotes: 8

Views: 21060

Answers (1)

Roman Marusyk
Roman Marusyk

Reputation: 24569

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 ?? "", "<[^>]*>" ,"")

Upvotes: 8

Related Questions