老是出错,帮忙看看
____________________________________
Imports System
Imports Microsoft.VisualBasic
Namespace nsASPNETCase1
Public Class Cstring
Public version As String = "2.0"
Public Overridable Function HTMLencode(ByVal strinput As String) As String
strinput = Replace(strinput, "&", "&")
strinput = Replace(strinput, "<", "<")
strinput = Replace(strinput, ">", ">")
strinput = Replace(strinput, Chr(10), "<Br>")
strinput = Replace(strinput, Chr(32), " ")
strinput = Replace(strinput, Chr(9), "  :") '替换制表符
HTMLencode = strinput
End Function
End Class
End Namespace
____________________________________________________________________
<%@ Page Language="VB" validaterequest="false" %>
<%@ Import Namespace ="nsaspnetcase1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub enter_click(ByVal sender As Object, ByVal e As EventArgs)
Dim strconvert As New Cstring()
message.Text = strconvert.HTMLencode(txt.Text)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox id="txt" TextMode ="multiLine" Columns ="40" Rows ="4" runat ="server" />
<br />
<asp:Button ID="enter" OnClick ="enter_click" Text ="提交" runat ="server" />
<br />
<asp:Label ID="message" runat ="server" />
</div>
</form>
</body>
</html>
[此贴子已经被作者于2007-5-25 18:25:26编辑过]