Saturday, March 24, 2012

Exceptions

Hi,I'm using webservices to get data from the server in my application, in certain circumstances I throw an exception that gets catched in the failed callback function in the client, and depending in the exception type a message is shown to the user, this works great when the browser and the server are in the same machine, but when I call the application from a different machine I get what I think is a default exception, with the message "There was an error processing the request." instead of my own exception, could someone tell me if this is by design, and if so how can I change this behavior so I can get my exceptions, or I'm doing something wrong here?

Thanks.

This is quite true when application is deployed with debugmode set false which we always do. Read the following article where I have shown an effective error logging in asp.net ajax.
http://dotnetslackers.com/columns/ajax/AspNetAjaxExceptionLogging.aspx


Thanks for the great article Kazi,I concord with you, the (some) exception information should be presented in the client side, I understand this is done for security reasons, but in my case for example I catch all exceptions in the webserver and log the relevant ones, and then only for some I throw a new exception to inform the user, for example when the user tries to save a duplicated record I catch the SqlException (this one doesn't need to be logged) and throw my own exception that tells the client application to show a message to the user telling him that there's all ready a record with that name in the database.


Yes, it should at least return the Exception message.


Hi,

In order to send real error message to the client side on a different machine, please turn CustomError off in web.config.


<customErrors mode="Off" />


Yes I have been forced to do that already, I really don't like it, but I need this for my implementation to work, fortunately I already catch all (I certainly hope so) the exceptions and only show the information I want in the client.

No comments:

Post a Comment