Name
ToString
Synopsis
string = HttpException.ToString( )
Returns a string containing the fully qualified name of the exception, the error message (if available), the name of the inner exception, and the stack trace.
Parameters
-
string A string variable to receive the value from the method.
Example
The code example causes an exception by attempting to set a Session
value on a page for which the EnableSessionState
attribute of the @
Page
directive has been set to False. The example code
then displays the string representation of the resulting exception:
<%@ Page Language="vb" EnableSessionState="false" %>
Sub Page_Load( )
Try
Session("foo") = "Foo"
Catch HttpEx As HttpException
Message.Text = "ERROR:<br/>"
Message.Text &= "String Representation of Exception: " & _
HttpEx.ToString( ) & "<br/>"
End Try
End SubNotes
This method provides a quick and easy shortcut for displaying the available information about a given exception without having to call the individual methods and properties of the HttpException object.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access