Saturday, July 21, 2007

Exception Handling : Server Object Exception Handling Events

Server object’s Exception Handling events:
GetLastError: Get the last exception that occurred on the server
ClearError: Clear the last error


Code Listing:GetLastError
CodeListing:ClearError

Exception ex = Server.GetLastError();
Session[“Error”] = ex.Message;
Server.ClearError();
Server.Transfer(“ErrorEvents.aspx”);

No comments: