H
Hero41Day
Hi,
I'm looking for a easy simple way, using Regular expression to remove
any dangerous HTML from user posts which might put other users at risk.
right now i'm using this regular expression:
return
Regex.Replace(text,@"</?(((?!a|b|i|u|img|table|tr|td|/)[^>]*)|((a|b|i|u|table|tr|td|img)[^\s>]{1,}))*>","$1");
the problem is that its still remove the image tag, even though i don't
care that it will stay.
Does anyone have a better idea?
And yes, i'm aware to the "ValidateRequest" flag, but i don't want to
use it in those cases.
Thanks.
I'm looking for a easy simple way, using Regular expression to remove
any dangerous HTML from user posts which might put other users at risk.
right now i'm using this regular expression:
return
Regex.Replace(text,@"</?(((?!a|b|i|u|img|table|tr|td|/)[^>]*)|((a|b|i|u|table|tr|td|img)[^\s>]{1,}))*>","$1");
the problem is that its still remove the image tag, even though i don't
care that it will stay.
Does anyone have a better idea?
And yes, i'm aware to the "ValidateRequest" flag, but i don't want to
use it in those cases.
Thanks.