Public Static String Tosafehtmlstring ( String Content)
{
If (Content = Null )
{
Return String . Empty;
}
If ( String . Isnullorwhitespace (content ))
{
Return Content;
}
Content = RegEx. Replace (content, @" <SCRIPT [^ <>] *?> [\ S] *? </SCRIPT> " , String. Empty, regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <([\ W] +? [^ <>] *?) (Class | style) = "" [^ ""] *? "" ([^ <>] *?)> " , " <$1 $3> " , Regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <([\ W] +? [^ <>] *?) (Class | style) = '[^'] *? '([^ <>] *?)> " , " <$1 $3> " , Regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <([\ W] +? [^ <>] *?) (Class | style) = [^ <>] *? ([^ <>] *? |)> " , " <$1 $3> " , Regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <Frameset [^ <>] *?> [\ S] *? </Frameset> " , String. Empty, regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <Frameset [^ <>] *?> " , String. Empty, regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <IFRAME [^ <>] *?> [\ S] *? </Iframe> " , String. Empty, regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <IFRAME [^ <>] *?> " , String. Empty, regexoptions. ignorecase );
Content = RegEx. Replace (content, @" <SCRIPT [^ <>] *?> " , String. Empty, regexoptions. ignorecase );
Return Content;
}