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


Similar Messages:

MVC Exception Not Being Caught In Try Catch Block?

Jan 21, 2010

I have tried this on two different controller methods now, and both times, even if the linq2sql doesn't allow the data to be saved, the code never jumps into the catch block.

I've watched the noun object in the middle of the trace, and the isvalid property is false, but the modelstate isvalid is true. Either way, the code never jumps into the catch block.I'm pulling my hair out about this. I feel like it will be something really silly.

The code all works similar to nerd dinner.

NounRepository nounRepository = new NounRepository();
Noun noun = new Noun();
try[code]...

I'd rather not have to add code in this manner though, as it seems like an unnecessary duplication.

View 3 Replies

Security Exception Not Being Caught In Global.asax?

Feb 11, 2011

I have (pretty much) the following code in my protected void Application_Error(object sender, EventArgs e) method in Global.asax....

Exception ex = Server.GetLastError();

if (ex is
System.Security.SecurityException)

Response.Redirect("Logon.aspx");

else

Response.Redirect("ErrorPage.aspx");

If I navigate to a page before I log on the exception is caught and I am redirected to Login.aspx as I would expect. However, this is only working when debugging using VS on my local machine.When uploaded to the live environment, the exception is not caught and the user is presented with "Security Exception - Request for principal permission failed."

View 1 Replies

C# - Dynamicdata Validation Exception Message Caught In JavaScript, Not DynamicValidator

Feb 12, 2010

I have a page here with a few list views on it that are all bound to Linq data sources and they seem to be working just fine.I want to add validation such that when a checkbox (IsVoid on the object) is checked, comments must be entered (VoidedComments on the object).

Here's the bound object's OnValidate method:

partial void OnValidate(ChangeAction action)
{
if (action == ChangeAction.Update) [code]....

Despite there being a dynamic validator on the page referencing the same ValidationGroup as the dynamic control, when the exception fires, it's caught in JavaScript and the debugger wants to break in. The message is never delivered to the UI as expected.

View 2 Replies

Web Forms :: Avoid Sending Emails Each Time An Exception Is Caught?

Mar 23, 2011

I have a .exe application that runs daily. I want to avoid sending emails each time an exception is caught.I want to compile a list of errors (in a unique log file fileupload[mm/dd/yyyy].log) while the application runs. Then send an email with the log attached after it the application finishes.What would be the approach for this?

View 1 Replies

SQL Server :: An Exception Of Type 'System.Data.SqlClient.SqlException' Occurred And Was Caught?

Oct 17, 2010

When the Stored procedure is executed through SQL Server Management Studio, its taking 23 seconds,When the same Stored proc is called through web app, its throwing below copied exception. It is noticed that when the data is more than 100k records this exception is thrown other wise expected records are shown in UI. Another stored proc from the same app returns over 150k records without any excetpion. Can't conclude that the exception is in Stored proc, because it works from SQL Server Management studio, but throws below exception from Web app.

[Code]....

View 5 Replies

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

Aug 3, 2010

I am working on a 3-tier asp.net 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 asp.net 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

WCF / ASMX :: Return Dynamic / When Returns To Aspx Error At Aspx(no Exception Gets Caught At  @ Service)?

Feb 9, 2011

In our project WCF service is acting as our BLL.

i had scenario where i had to fill list of object class without knowing its type see code:

Added contract

[OperationContract]
dynamic GetReferenceTableData(string tableName);

method in service:

public dynamic GetReferenceTableData(string tableName)
{
try
{
dynamic tableData = ReferenceTableDAL.GetReferenceTableData(tableName);
return tableData;
}
catch (Exception ex)
{
throw;
}
}
method at DAL(ReferenceTableDAL):
public static dynamic GetReferenceTableData(string tableName)
{
Database db = DatabaseFactory.CreateDatabase(Flags.ConnectionStringKey);
DbCommand dbCommand = db.GetStoredProcCommand("USP_GETTABLEDATA");
dynamic objDynamic = null;
if (tableName.ToLower() == "a")
{
objDynamic = new List<A>();
}
else if (tableName.ToLower() == "b")
{
objDynamic = new List<B>();
}
else if (tableName.ToLower() == "c")
{
objDynamic = new List<C>();
}
try
{
db.DiscoverParameters(dbCommand);
dbCommand.Parameters["IN_TABLENAME"].Value = tableName;
DataSet dsTableData = db.ExecuteDataSet(dbCommand);
if (tableName.ToLower() == "a")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((A)dataRow);
}
}
else if (tableName.ToLower() == "b")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((B)dataRow);
}
}
else if (tableName.ToLower() == "c")
{
foreach (DataRow dataRow in dsTableData.Tables[0].Rows)
{
objDynamic.Add((C)dataRow);
}
}
}
catch (Exception ex)
{
throw;
}
return objDynamic;
}
@ Aspx
try
{
using (DataServiceRef.DataServiceClient petService = new DataServiceRef.DataServiceClient())
{
dynamic tableData = petService.GetReferenceTableData(tableName);
//tableData is null ,exception
}
}
catch (Exception ex)
{
throw;
}

There is no exception at dal or service end when i debug list gets filled ok but when returns to aspx error at aspx(no exception gets caught at @ service) but exception at aspx i.e:

Message:The underlying connection was closed: The connection was closed unexpectedly.
Stack Trace: at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

View 3 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:

[Code]....

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 :
try
{
}
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

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

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?

[Code]....

View 3 Replies

MVC :: DateTime Validation Exceptions Not Caught?

Jul 6, 2010

[Code]....

When doing some custom validation on DateTime fields the thrown exceptions are not caught and simply cause the application to end.

View 4 Replies

Security :: 401.2 Error Not Being Caught By Web.config?

Jul 6, 2010

I have the following definition in my web.config

[Code]....

But when I get a 401.2 it still gives me the ugly Access Denied Screen instead of my redirect page. The files are in the root with no security on them.

View 6 Replies

VS 2010 - Email With Link Gets Caught As Spam

Jun 22, 2012

I'm sending emails inviting contacts to login to setup an account on a customers website. I'm using SMTP from web methods in code behind... These emails have clickable links that make them get caught as spam.

Code:
<html><body>Please use this link <a href="http://xxx.yyy.zz.aa/asdfasdf.aspx?invite=' + CAST(@guid as varchar(100)) + '">Click Here</a> to create an account.</body></html>

How can I avoid this?

View 3 Replies

Informing The Client / View Of Exceptions Caught By The Controller?

Dec 18, 2010

I have basic client-side validation working in my MVC3 RC2 application, but I'm now interested in recommended practices for conveying server side validation errors, as well as server side exceptions, to the client. I know I can add properties to my view model and display these if populated, but I don't want to reinvent the wheel, and I would like to tie in with MVC's way of doing things. So, how should I, a) notify the user of server side validation errors, and, b) notify the user of server side exceptions, e.g.

View 1 Replies

Web Forms :: Exceptions From Business Logic Layer Not Caught In Application_Error?

Nov 11, 2010

I know there are a few posts on this issue already, however I haven't found the answers I was really looking for.

My situation is like this: I have a DLL project containing my business logic. Then I have a web application that refers to this DLL, and calls a function from it. And I have a global.asax which handles errors on Application_Error

Sample:

// MyWebsite.aspx.cs
using MyBusinessLogic;
protected void Page_Load(object sender, EventArgs e)
{
MyBusinessLogicClass.DoSomething();
}
// global.asax.cs
protected void Application_Error(object sender, EventArgs e)

[Code].....

View 6 Replies

Web Forms :: Best Method Of Sending Through E-mail And Error That Is Caught With The Try, Catch, Etc

Oct 12, 2010

Using VB, VS 2010, I am wanting a remote web app to send me an e-mail when it finds an error using the try catch. What is the best way to do that?

View 4 Replies

Visual Studio 2005 - Web Site Project - Errors Not Caught At Compile Time?

May 7, 2010

For the first time in my career, I'm working on an ASP.Net (v3.5) project that has been set up as a Visual Studio 2008/10 Web Site Project.

I'm not keen on this way of working this way for various reasons but for the moment and until such time as the company sees the virtue in working in an environment with namespaces, designer and project files etc., I have to continue with the existing codebase.

I've run into some odd issues since I began this but perhaps the oddest one of all is that althought VS lets me build the code, it doesn't reliably pick up compilation errors so these are not noticed until runtime.

I know the website model allows dynamic/hot compilation when a request is made for a specific but I can't see why it wouldn't do this when I manually (F5) build/rebuild the project. Its immensely annoying as you can imagine and I can't find a workaround.

View 3 Replies

Configuration :: Web.config 404 CustomErrors / Change The Url To Def23947823h.aspx It Is Caught And Redirects To Correct Page?

Sep 14, 2010

I am having an issue where if I change my url to .asp from .aspx i get a 404 error but it is not handled by my custom errors. If I change the url to def23947823h.aspx it is caught and redirects to correct page.

[Code]....

View 8 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.

(Microsoft.SqlServer.Express.ConnectionInfo)

ADDITIONAL INFORMATION:

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]

BUTTONS:

OK

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







Copyrights 2005-15 www.BigResource.com, All rights reserved