Quantcast
Channel: AuthorCode » Windows Controls
Viewing all articles
Browse latest Browse all 10

Render , and & characters in Web Browser in Visual Basic

0
0

Some time When you need to use some characters as text like and & in your web page, browsers understand these characters as the part of the html tags and they rendered incorrectly these characters unless characters are escaped as <, >, and & respectively.

This scenario is same in Web browser control in .net. Web browser also rendered these characters incorrectly.
See the following string:

  1. Dim RenderString as String="Welcome to <Authorcode>"

For the correct rendering of above string, we need to encode this string. You can encode this string with the help of System.Web.Server.HtmlEncode() method.

  1. Dim RenderString as String="Welcome to <Authorcode>"
  2. Dim EncodedString As String = Server.HtmlEncode(RenderString )

Server.HtmlEncode() method requires to import the System.Web assembly so add the reference this dll in your project.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles



Latest Images