Extend the exception thrown from ASP.NET when calling Webservice from jQuery

I am using jQuery to dynamically control controls in an ASP.NET development environment using JSON and WebServices. As part of this solution, I have a level of business logic that has a built-in verification mechanism (i.e., Validating properties and business rules similar to CSLA properties)

When requesting to dynamically load a new control using JQuery and ASP.NET WebService, I would like to confirm the entry of the current control with a business logic validation mechanism (for example, server-side validation) and notify the user if there were problems.

I managed to achieve this, however, when the validation check failed in the web service, I would like to add a client exception that contains the ID of the validation field and the related error messages.

In jQuery, I am testing this particular ExceptionType and want to dynamically apply error messages to the controls listed in the properties of the exception type. This is where my problem arises. Although I created a custom exception with custom properties, the exception that JQuery passes in JSON format from WebService is still the standard exception, and none of the additional properties listed are. I could just create a JSON-formatted string of values ​​in the property of the exception message, but in the end I would prefer something more elegant. Does anyone know how you can override the serialized exception thrown by ASP.NET for situations like this ...

Thanks in advance...

G

+5
1

- - , ASP.NET . ,

[...] / . - , [...]

HTTP, - , 500 , 401 - else .. , - , , , .

ASP.NET AJAX.

+3

All Articles