Exception Handling Application Block Exception Handler running in ASP.NET cannot call Response.End()



Using .NET 3.5, ASP.NET, Enterprise Library 4.1 Exception Handling and Logging blocks, I wrote a custom exception handler to display a standard error page, as follows:


[ConfigurationElementType(typeof(CustomHandlerData))]
public class PageExceptionHandler : IExceptionHandler {
public PageExceptionHandler(NameValueCollection ignore) {
}
public Exception HandleException(Exception ex, Guid handlingInstanceID) {
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ContentEncoding = Encoding.UTF8;
response.ContentType = "text/html";

Related to : Exception Handling Application Block Exception Handler running in ASP.NET cannot call Response.End()
Exception Handling Application Block Exception Handler running in ASP.NET cannot call Response.End()
ASP & ASP.net

Using .NET 3.5, ASP.NET, Enterprise Library 4.1 Exception Handling and Logging blocks, I wrote a custom exception handler to display a standard error page, as follows:


[ConfigurationElementType(typeof(CustomHandlerData))]
public class PageExceptionHandler : IExceptionHandler {
public PageExceptionHandler(NameValueCollection ignore) {
}
public Exception HandleException(Exception ex, Guid handlingInstanceID) {
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ContentEncoding = Encoding.UTF8;
response.ContentType = "text/html";
Exception handling in asp.net n-tier application
ASP & ASP.net

I have an ASP.Net web application, which follows n-tier architecture. It has Data Access Layer, Business Layer and UI Layer. I just want to know, what are the best practices to handle the exceptions and logging them. Some of my senior teammates are telling that to throw the exception from DAL / BL and catch them in UI layer to log them into a text file. My point is, why should not we catch the same and log them into log file directly from DAL/BL layers.


Please suggest me some best practices for exception handling in asp.net N-tier applications and MVC as well.


Exception handling in a three-tier Asp.Net application
ASP & ASP.net

1) To my understanding, in a three-tier Asp.Net application we should implement exception handling in the following way:


a - we should put try-catch block around block of code ( located in any of the three layers ) from which we expect the page to gracefully recover from ( when this code generates an exception )?


b - we shouldn’t put try-catch blocks around code ( located in either of the three layers ) from which we don’t expect the page to gracefully recover from. Instead, Asp.Net application should always manage these unhandled exceptions through global exception handler ( Application_Error/Page_Error<

Help with Exception Handling in ASP.NET C# Application
ASP & ASP.net

yesterday i posted a question regarding the Exception Handling technique, but i did'nt quite get a precise answer, partly because my question must not have been precise.
So i will ask it more precisely.


There is a method in my BLL for authenticating user. If a user is authenticated it returns me the instance of the User class which i store in the session object for further references.
the method looks something like this...


public static UsersEnt LoadUserInfo(string email)
{
SqlDataReader reader = null;
UsersEnt user = null;
using (ConnectionManager cm = new ConnectionManager())
{
Using Enterprise Library Exception Handling Application Block in ASP.NET - Code Review
ASP & ASP.net

I'm implementing the Enterprise Library Exception Handling Application Block in an ASP.NET application that I am building. I'm planning to handle uncaught application exceptions by placing the following code in my Global.asax.cs:


protected void Application_Error()
{
Exception error = Server.GetLastError();
Exception errorToThrow;
if (ExceptionPolicy.HandleException(error, "Application Error", out errorToThrow))
{
if (errorToThrow != null)
throw errorToThrow;
}
else
Server.ClearError();
}
what is difference between Exception handling Application block & Exception handling
ASP & ASP.net

what is difference between Exception handling Application block & Exception handling in regular dot net classes ? i don't think it is beneficial to use of Exception handling Application block. What is exact use of that block ??



Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .