Edit

Share via


HttpServerUtility.GetLastError Method

Definition

Returns the previous exception.

public Exception GetLastError();

Returns

The previous exception that was thrown.

Examples

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.

Exception LastError;
String ErrMessage;

LastError = Server.GetLastError();

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

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

Applies to

See also