I started to post my ASP.Net related note here, and I was in need to copy past my ASP.Net code to my own blog input form. Converting "<" and ">" is a time consuming work. I have written a quick code to convert those 2 characters to be able to display as a HTML on web.
Here is how I wrote it. Working version is at http://asp.syantien.com/pgeConvertToHTMLSource01.aspx
<%@ Page Language="VB"
MasterPageFile="~/MasterPageSub01.master" _
AutoEventWireup="false" _
CodeFile="pgeConvertToHTMLSource01.aspx.vb" _
Inherits="pgeConvertToHTMLSource01" _
ValidateRequest="false" _
Title="Convert .Net Source to HTML Srouce - ASP.Net n more" %>
<asp:Content ID="Content1" _
ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<h1>
Convert .Net Source to HTML Source</h1>
Enter your ASP.Net Source
<br />
<asp:TextBox ID="txtSource" runat="server" _
TextMode="MultiLine" Width="90%" Height="250px"></asp:TextBox>
<br />
<asp:Label ID="lblError" runat="server" ForeColor="Red" />
<br />
<asp:Button ID="btnConvert" runat="server" Text="Convert" _
Width="90%" />
<br /><br />
Converted Strings
<br />
<asp:TextBox ID="txtResult" runat="server" _
TextMode="MultiLine" Width="90%" Height="250px"></asp:TextBox>
<br />
Note:
<br />
*No more than 50 lines
</asp:Content>
'======================
'Syantien, ASP.Net n More
'Convert (Replace) ASP.net Source to HTML Source
'asp.vb file
'======================
Partial Class pgeConvertToHTMLSource01
Inherits System.Web.UI.Page
Protected Sub btnConvert_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles btnConvert.Click
'Put Limit on Size
If txtSource.Rows <= 50 Then
'Refresh
lblError.Text = ""
txtResult.Text = ""
'Convert
txtResult.Text = Replace(Replace(txtSource.Text, ">", _
">"), "<", "<")
Else
'Display an error
lblError.Text = "Too big, needs to be less than 50 lines, _
please try again."
End If
End Sub
End Class