How to display HTML tags properly from a text file using C#?

So right now I'm using something like this in C#: Response.Write(Server.HtmlEncode(line)); This will grab a line from a text file and display the stuff on screen - it works. My goal was to have the lines from the text file show something like this (HTML formatting in lines of text file): Link

Unfortunately, for some reason the `<` and `>` are being converted to `<` and `>` before it gets turned into HTML, which exposes all the HTML code as text and simply doesn't work. I have tried looking into the WebBrowser control and stuff but I don't understand what I'm supposed to do. For example, I tried this from a site: WebBrowser browser = new WebBrowser(); browser.Navigate("about:blank"); browser.Document.Write(Server.HtmlEncode(line)); ...but it didn't work. I'm looking for something very simple and with a clear example I can mimic, if possible. Thanks! I will make sure to select an answer too.

以上就是How to display HTML tags properly from a text file using C#?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » HTML5 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏