Wednesday, 16 July 2014

Exception in Asp.Net

Try
{
}
catch (SqlException ex)
{
if (ex.Number == -2)
{
throw new Exception("A System Timeout occurred while loading data - Please press the browser Refresh button to refresh the page");
}
else
{
throw new Exception(ex.StackTrace);
}
}
catch (Exception ex)
{
objCommonMethods.GenericExceptionMethod(ex);
spnMessage.Visible = true;
objCommonMethods.DisplayMessage(this.spnMessage, "Error", ex.Message);
}
finally
{
if (objConnection != null)
{
objConnection.Close();
}
oConn.Close();
oConn.Dispose();
objWorklistItem = null;
}