I'm making an application that involves logging into a server, however, the post data needs some encoding.
Dim strEncUsername As String = Server.HtmlEncode(Me.txtUsername.Text)
If you add a reference to System.Web to your project you can use the following to html encode your string
Dim strEncUsername As String = System.Web.HttpUtility.HtmlEncode(Me.txtUsername.Text)
Screenshot of intellisense showing HtmlEncode:
Screenshot of references in project:
Output from application:
unsafe text: <em>evil em tags within</em> safe text: <em>evil em tags within</em>