Hi, I'm looking for the equivalent in C# of this function: strip_tags().
I want to use it to validate some input and avoid SQL injection. Any ideas?

Thanks in advance.

Hi, I'm looking for the equivalent in C# of this function: strip_tags().
I want to use it to validate some input and avoid SQL injection. Any ideas?

Thanks in advance.

I wrote a C# method designed especially for ASP.NET.

It emulates the strip_tags() function in PHP and does a very good job too (5 microseconds on my laptop on a 80kb HTML).

All about it (free code and documentation) you can find at my Code Project Article

use regular expresion to strip tags, like

System.Text.RegularExpressions.Regex regHtml = new System.Text.RegularExpressions.Regex("<[^>]*>");
string s = regHtml.Replace(InputString,"");
This question has already been answered. Start a new discussion instead.