This can be done by implementing a method called GetLastError(). Generally this returns a ASPError object stating the error condition that has occurred. This method will work only before the .ASP page sent any content to the Client.
LastErrorOccured = Server.GetLastError();
if (LastErrorOccured != null)
ShowErrMessage = LastErrorOccured.Message;
ShowErrMessage = "No Errors";
Response.Write("Last Error Occured = " + ShowErrMessage);
Asked In: Many Interviews |