Architecture :: How To Log Dal Exception And Showing Alert To User / Exception Occurs

Aug 3, 2010

I am working on a 3-tier application. Currently I'm stuck up in a situation where I need to handle a specific type of exception (User Defined) in DAL and Show alert to the user if that exception occurs in DAL.

I tried following things:

1) I raised that exception from the DAL and catch it in BLL and throw a new BLL exception to for that DAL exception and finally catch it in the UI layer to show the alert to the user. I've successfully implement this in my project. But there are some issues in this approach. First of all I feel this is not right way to do this as it may lead to performance related issues. Secondly, the application contains more than 500 pages and classes. so I need to attach additional catch block in every method to catch the BLL exception. which is the last option i'd like to take.

2) in second approach I logged the the DAL exception into a text file. but problem in this approach is that how could the UI layer know that exception has occurred and show the alert to the user. Is there any event in where i could handle all this activities?

my question is what is the best approach to handle this type of situation? Will Exception handling block help me in this?

I've tried reading many articles on this but i couldn't get an answer for my question? I might not be using right keywords for my search.

View 4 Replies

Similar Messages:

DataSource Controls :: Exception Occurs Every Time Without Any Error?

May 5, 2010

In my application I am accessing my DB using simple stored procedure..but My code got exception....while I debug the code I have seen that the code is executed successfully and while the whole try block has been executed then the code call the exception but more ridiculously without any kind of is my code


View 2 Replies

Call Session.Abandon() When An Unhandled Exception Occurs?

Jan 18, 2010

In ASP.NET should we call Session.Abandon() when an unhandled exception occurs?There are many end users that hit "refresh" or "back" in the web browser in order to resubmit the request.I would like to prevent this behavior by resetting the context.TIA.

View 2 Replies

Handle Exception Into Alert Box?

Jan 27, 2010

How can I coerce an exception message that has bubbled from my business layer into an alert box in javascript?BTW, I'm using ASP.NET MVC 1.0.

View 1 Replies

Web Forms :: Redirect To A Login Page When Will Exception Or Session Expaires Occurs?

Nov 9, 2010

from the web .config file i want to redirect to a login page when will exception or session expaires occurs so how to do that one?

View 3 Replies

Web Forms :: Display Message Details In Modal Popup When Exception Occurs

Feb 13, 2013

Handling the exception in

View 1 Replies

Forms Data Controls ::Created Unique Index, When Exception Occurs On Update?

May 5, 2010

using 2005 and SQL Server 2005.I had similar issue yesterday: I created a unique index on a table to prevent duplicates when user tries to edit existing records in a gridview.This works fine and I am seeing the "cannot insert duplicate key row message...." however I need to catch the exception because I do not want to display the table and column names.I have this set up but its not catching the exception, the exception is displaying but not my version, does anyone know in what gridview event and how I can catch and customize this exception? what i have now (but not working ) is:


View 2 Replies

Javascript - How To Show Exception Variable Value In Alert Box Using C#

Oct 14, 2010

have the code...try
do something..
catch(Exception ex)

but the alert box is not displaying...if i use the code.

try{do some thing}
catch (Exception ex)
Response.Write("<script>alert("an error occur")</script>");

alert box could i can display the exception variable in alert box

View 4 Replies

Architecture :: Exception Layer In N-tier Architecture?

May 13, 2010

I'm developing a n-tier architecture... I'm confused with handling exception in the layers... Is it a good practise to add a Exception Layer to the architecture.

View 3 Replies

Architecture :: Exception Handling In MVP?

May 28, 2010

I'm wondering what's the preferred way to manage exceptions in an MVP implemented with a Passive View.

There's a discussion in my company about putting try/catch blocks in the presenter or only in the view.

In my opinion the logical top level caller is the presenter (even if the actual one is the view).

Moreover I can test the presenter and not the view. This is the reason why I prefer to define a method in the view interface:


View 2 Replies

Architecture :: Exception Not Caught?

Nov 22, 2010

My question is, I have a PL, BL and DAL layered architecture (In which all these components are hosted in a single web server).

With the above architecture, i have only placed try catch block in all my events in aspx.cs pages in PL ALONE and NO TRY CATCH BLOCK IN BL AND DAL.

There is one command timeout exception happening at the DAL layer and the exception bubbles back to the PL(aspx page event which is having the try catch block). This try catch block catches the exeption and logs the exception information to database and displays useful information in the UI.

WIth the above approach, sometime very rarely(only once till now) exception is not caught in the PL for the commandtimeout exception thrown from DAL implicitly.I confirmed the exception is not caught because the exception information is not logged into the database and also no useful information displayed in UI.

Why the exception from DAL dint bubble down to PL? Do we need to explicitly throw exception from DAL or BL i.e by having try catch block in BL and DAL ?

View 1 Replies

DataSource Controls :: Getting Exception / An Exception Occurred While Executing A Transact-SQL Statement Or Batch

Jan 1, 2010

i need to restore Database.mdf; I create a blank new database exactly the same name as the .mdf file. However, I could not restore the database.

The error message prompted was:

TITLE: Microsoft SQL Server Management Studio Express

An exception occurred while executing a Transact-SQL statement or batch.



Cannot open backup device 'C:inetpubwwwrootTCPSystemApp_DataDatabase.mdf'. Operating system error 32(error not found).

RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3201)

click: [URL]



View 10 Replies

C# - How Do I Get Specific Details About An Exception From A General Exception Class Object

Feb 4, 2010

In ASP.NET,How can i know the Specific details about an exception (like What kind of Exception it is (FileNotFound /Arithmentc etc..) )from a General Exception class object.

View 2 Replies

Architecture :: Best Practice For Handling Exception?

Jun 3, 2010

I devide my website on 3 layers :

DAL(Data Access) - simple extract data from DB using LINQ
BLL(Business Logic) -

cache data and in try/catch block call function from DAL and throw it to UI :
catch (Exception ex)
//Log error
throw ex

UI (User Interface) - simple working without handling any exception,

So if error occured in BLL i will be redirected to Error.aspx page with message that something wrong.

how and where handle exceptions, or may be exists common patter where handle and how to inform user about errors ? Can anybody share bes practice.

View 1 Replies

C# - Exception Handling - Implement Custom Exception Classes?

Jul 2, 2010

i have this application structure:

1. Presentation Layer which calls

2. Business Logic Layer which in turn calls

3. Data Access Layer to do the dealing with the database.

Now i have a Contacts page from where i can add a new contact to the database.So to add a New Contact i fill in all the required details and then call a Add Method (residing in the BLL) from the page, which in turn call a Add Method residing in the DAL.this method in the DAL returns the Current Identity of the record which is then return back to the BLL method and finally delivered on the page.this is fine. but what if a get an exception how do i handle it properly because the method in DAL has a return type of int and i dont want to throw another error!! coz other wise i will have to write try catch in almost all the methods.

//something like this
public int AddMethod(ContactClass contactObj)
int result = 0;[code]...

rather i want to show the user a user-friendly message which they can easily understand and in the mean while i will send a mail to myself documenting the Error that just can i implement my custom exception classes.

View 2 Replies

Architecture :: Design A Good Exception Handling?

Jun 4, 2010

I need to design a good exception handling. That can include logging and user friendly error page etc I read more articles and got some ideas. I am not using Enterprise Library now.

View 4 Replies

Architecture :: Exception Handling In Multi-tiered Applications?

Apr 27, 2010

Even though I'm trying to implement exception handling in a multi-tiered Windows application, catching and throwing exceptions should be the same for Windows and Web (sans global.asax and web.config custom errors).

I have a webform with a texbox that displays exceptions. So my webform invokes a method in BusinessTier class which then invokes a method in DataTier class. How can I throw my DataTier method exception so it reaches my webform?

View 2 Replies

Architecture :: Dynamic Exception Handling In Saas Application?

Dec 29, 2010

Dynamic Exception handling in Saas application

View 3 Replies

Ways To Identify A Particular Exception From Exception Class?

May 18, 2010

Is there any way to uniquely identify a particular exception from the general exception class.

i.e any property or method that retrieves a unique identifier that to identify a particular exception.

I have kept some error values and corresponding error texts in an xml file. I want to read that xml file and have to taken the error ids and fix the corresponding texts to a label. in the case of a system exception we have to identify a particular exception.

View 1 Replies

WCF / ASMX :: Difference Between Exception And Fault Exception?

Jul 18, 2010

Difference between Exception and Fault Exception..?

Can i use Fault Exception when i get the Exception.

View 5 Replies

C# - Exception Is Like The Padding Is Invalid And Cannot Be Removed Exception?

Jul 12, 2010

We're getting this InternalSubStringWithChecks exception with our application's healthMonitoring. This exception is like the Padding is invalid and cannot be removed exception where it's being recorded and we're getting a notification email but the end user is unaware that an actual error has happened. Though we don't want our event log filled up with this rubbish! The stack trace is:

Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest

View 1 Replies

Error Handling - Showing Variable Values In A Global Exception?

Jan 25, 2011

I have a global error trap in the Application_Error method of Global.asax that writes any unhandled exception to a log file.

Is there anyway of reporting the variable names and their values as part of the exception report?

View 2 Replies

Architecture :: Exception Handling Between Data Access Layer And Code Behind?

Jul 20, 2010

If an error happens in the DA_layer, how do I pass it do the code_bedhing to show the user?


View 3 Replies

Console Application Calling Datalayer Throws An Exception "The Type Initializer For Threw An Exception."

Aug 17, 2010

I have simple 3 tier web application and have mostly CRUDE functionalities. Recently I required to add new console application to the existing solution in which I call data layer methods for retrieving data from DB but I get an exception "The type initializer for threw an exception."When I debugged I found that the exception is thrown at datalayer on first line of class where I get connectionstring from

web.config, the code is public static readonly string CONNECT_STRING =


Now if I hardcode the connection string value like public static readonly string CONNECT_STRING = "Data Source=XYZ;uid=sa;password=XXX;initial catalog=ABC;"

it works fine.I don't understand what is the issue here as web application works fine with this datalayer.

View 2 Replies

Web Forms :: How To Show Exception To The User

Jun 11, 2010

I have an ASPX page where I want to show an error id when an unhandled error occurs. So I throw an Exception with an error id. However all the user sees is an "Internal Server Error 500" from IIS/ASP-NET Dev. How can I control this? I want the user to either see my Exception.

View 5 Replies

Copyrights 2005-15, All rights reserved