asp.net.ph

Server.GetLastError Method

System.Web Namespace   HttpServerUtility Class


Returns the previous exception.

[ VB ]
Public Function GetLastError ( ) As Exception

[ C# ]
public Exception GetLastError ( );

[ C++ ]
public: Exception* GetLastError ( );

[ JScript ]
public function GetLastError ( ) : Exception;

Return Value

The previous exception that was thrown.

Example

The following example prints a description of the application's last error to the HTTP output stream. It prints "No Errors" if no errors have been encountered.

[ VB ]
Dim LastError As Exception
Dim ErrMessage As String

LastError = Server.GetLastError ( ) 

If LastError Is Nothing Then
   ErrMessage = LastError.Message
Else
   ErrMessage = "No Errors"
End If
 
Response.Write ( "Last Error = " & ErrMessage )

[ C# ]
Exception LastError;
String ErrMessage;

LastError = Server.GetLastError ( );

if ( LastError != null ) 
   ErrMessage = LastError.Message;
else
   ErrMessage = "No Errors";

Response.Write ( "Last Error = " + ErrMessage );
See Also

HttpServerUtility Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph