C# equivalent for the PHP strip_tags()

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2007
Posts: 18
Reputation: rogelioz is an unknown quantity at this point 
Solved Threads: 0
rogelioz rogelioz is offline Offline
Newbie Poster

C# equivalent for the PHP strip_tags()

 
0
  #1
Mar 9th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 18
Reputation: rogelioz is an unknown quantity at this point 
Solved Threads: 0
rogelioz rogelioz is offline Offline
Newbie Poster

Re: C# equivalent for the PHP strip_tags()

 
0
  #2
Mar 10th, 2008
I'll use SqlParameters to validate the input. Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: AndreiR23 is an unknown quantity at this point 
Solved Threads: 0
AndreiR23's Avatar
AndreiR23 AndreiR23 is offline Offline
Newbie Poster

Re: C# equivalent for the PHP strip_tags()

 
0
  #3
Jun 8th, 2008
Originally Posted by rogelioz View Post
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: AndreiR23 is an unknown quantity at this point 
Solved Threads: 0
AndreiR23's Avatar
AndreiR23 AndreiR23 is offline Offline
Newbie Poster

Re: C# equivalent for the PHP strip_tags()

 
0
  #4
Nov 21st, 2008
Have a look on my implementation of the PHP's strip_tags function here -> http://www.codeproject.com/KB/MCMS/htmlTagStripper.aspx
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 23
Reputation: raziane is an unknown quantity at this point 
Solved Threads: 0
raziane raziane is offline Offline
Newbie Poster

Re: C# equivalent for the PHP strip_tags()

 
0
  #5
Nov 23rd, 2008
use regular expresion to strip tags, like

  1. System.Text.RegularExpressions.Regex regHtml = new System.Text.RegularExpressions.Regex("<[^>]*>");
  2. string s = regHtml.Replace(InputString,"");
Last edited by peter_budo; Nov 28th, 2008 at 1:07 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum


Views: 2779 | Replies: 4
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC