Hi
On this line i am getting above error - ExceptionLogging.SendExcepToDB(exception.Message);
Error - Cannot convert from string to system.exception
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
if (exception != null)
{
Response.Clear();
HttpException httpException = exception as HttpException;
if (httpException != null)
{
Response.Clear();
Server.ClearError();
ExceptionLogging.SendExcepToDB(exception.Message);
Response.Redirect("/Error/Index?message=exception.Message");
}
}
}
public static void SendExcepToDB(Exception exdb)
{
connecttion();
exepurl = HttpContext.Current.Request.Url.ToString();
SqlCommand com = new SqlCommand("ExceptionLoggingToDataBase", con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@ExceptionMsg", exdb.Message.ToString());
com.Parameters.AddWithValue("@ExceptionType", exdb.GetType().Name.ToString());
com.Parameters.AddWithValue("@ExceptionURL", exepurl);
com.Parameters.AddWithValue("@ExceptionSource", exdb.StackTrace.ToString());
com.ExecuteNonQuery();
}
Thanks