This documentation is archived and is not being maintained.
HttpServerUtility.GetLastError Method
.NET Framework 1.1
Returns the previous exception.
[Visual Basic] 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.
[Visual Basic] Dim LastError As Exception Dim ErrMessage As String LastError = Server.GetLastError() If Not 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); [C++] Exception* LastError; String* ErrMessage; LastError = Server->GetLastError(); if (LastError != 0) ErrMessage = LastError->Message; else ErrMessage = S"No Errors"; Response->Write(String::Format(S"Last Error = {0}", ErrMessage)); [JScript] var lastError : Exception var errMessage : String lastError = Server.GetLastError() if(lastError != null) errMessage = lastError.Message else errMessage = "No Errors" Response.Write("Last Error = " + errMessage)
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpServerUtility Class | HttpServerUtility Members | System.Web Namespace
Show: