0

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.

3
Contributors
4
Replies
6
Views
8 Years
Discussion Span
Last Post by raziane
0

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

0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.