How Can I strip HTML from Text in .NET?

后端 未结 9 1826
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-16 02:20

I have an asp.net web page that has a TinyMCE box. Users can format text and send the HTML to be stored in a database.

On the server, I would like to take strip the h

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-16 02:52

    You could:

    • Use a plain old TEXTAREA (styled for height/width/font/etc.) rather than TinyMCE.
    • Use TinyMCE's built-in configuration options for stripping unwanted HTML.
    • Use HtmlDecode(RegEx.Replace(mystring, "<[^>]+>", "")) on the server.

提交回复
热议问题