
HtmlDecode | 393
ServerUtility
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
ErrMessage = LastError.Message
Else
ErrMessage = "No Errors"
End If
Response.Write("Last Error = " & ErrMessage & "<br/><br/>")
Server.ClearError( )
End Sub
</script>
</head>
<body>
<form runat="server">
<h4><font face="verdana">Cause an Error to Occur...</font></h4>
<asp:button text="CauseError" OnClick="CauseError" runat="server"/>
</form>
</body>
</html>
Notes
You’ll find this method useful for getting information about an error from a
custom error-handling page. GetLastError returns information only when called
in the Page_Error or Application_Error event handlers because once these events
have been fired, the exception is cleared automatically.
HtmlDecode
returnstring = Server.HtmlDecode(s)
Server.HtmlDecode(s,output)
Returns a string in which any HTML information encoded by the HtmlEncode
method (described later in this chapter) is decoded back into its standard HTML
format.
Parameters
returnstring
A String variable to receive the decoded string from the method.
s
A string variable containing the encoded HTML that the method will decode.
output
An instance of any class derived from the
TextWriter class (found in the
System.IO namespace) used to capture the decoded string.
Example
The code example declares two string variables, sets the value of StrToDecode ...