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'll use SqlParameters to validate the input. Thanks.

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,"");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.