Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6781151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:35:26+00:00 2026-05-26T16:35:26+00:00

We have an ASMX web service which we invoke from our ASP.NET application using

  • 0

We have an ASMX web service which we invoke from our ASP.NET application using ajax (jQuery).

A typical example from our web methods would be something like:

[WebMethod]
public void DoSomething(BusinessObject myParameter)
{

    try
    {
       BL.DoSomethingWithParam(myParameter);
    }
    catch(Exception ex)
    { 
        //logic to log the actual exception goes here
        //and then we throw a more user-friendly error as so:
        throw new Exception("Unable to perform action such an such");
    }
}

On the client-side we would have something like this:

$.ajax({
   type: "POST",
   url: "WebService.asmx/DoSomething",
   data: "{}",
   contentType: "application/json; charset=utf-8",
   dataType: "json",
   success: function(result) {
      //do something with result.d
    },
   error: function(xhr, ajaxOptions, thrownError){ 
      alert($.parseJSON(xhr.Response.Text).Message);
   }
});

There are several problems with above approach, which I want to fix:

  1. When we test our application locally on our boxes, Internet Explorer displays the actual error message we throw on the throw new Exception line on our web method (In the case of the example code provided: “Unable to perform action such and such”) BUT when we deploy to the stage environment and test remotely; it no longer displays the error we throw, but rather this: "There has been an error processing your request."
  2. On Firefox (we didn’t test more browsers), it doesn’t display anything at all but Firebug shows a HTTP 500 error being thrown.

In conclusion we are not handling this appropriately, so my questions are:

  1. What’s the best way to communicate these errors to the client side and have consistent behavior amongst all browsers, both, when testing locally and remotely?
  2. Why doesn’t IE break the same way Firefox does? Granted, testing remotely IE sort of breaks too, by not showing the real error message and replacing it for the generic There has been an error processing your request but why doesn’t Firefox do the same?
  3. Considering the fact that this web service will also be consumed by other Java Web apps within the company, what’s the best way to maintain interoperability with these apps? How can we still throw these exceptions on our web methods and have the Java app be able to catch them and handle them appropriately?

One alternative we implemented -for now, we are still in development phase- is just to return a string from our web methods when an error occurs but this is really an ugly hack/inelegant way to do this.

Note: Don’t ask me where is the “There has been an error processing your request” message coming from. I don’t have the faintest idea. We don’t have anything in our code that would return that message.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:35:27+00:00Added an answer on May 26, 2026 at 4:35 pm

    I don’t know that a “correct” way has yet emerged due to the fact that how web services are being utilized is changing so rapidly and, ultimately, any client being constructed to consume the service is capable of handling whatever method you choose. I have no doubt that ultimately one will be devised but for now it’s up to you.

    That being said try to avoid some of the more common pitfalls I’ve seen in the past.

    1. Lack of Consistency: If your web service has multiple methods devise a way that they all may communicate errors in the same fashion to make your methods easier to consume. Personally I prefer following in the footsteps of protocol stacks and using some sort of consistent header. Build your resulting messages with a common header so that the same logic may be used throughout the client’s code to determine if the method call was successful.
    2. No Support For Multiple Error Messages: Sometimes multiple failures occurred. Blinding the client to the secondary error can be a nuisance and slow down debugging attempts.
    3. Lack of Identification for Error Messages: If the error is the result of a particular field being invalid allow the client to programmatically identify which field is the culprit based on information you provide.

    The approach I generally start with these days looks something like this:

    {
        Success: bool,
        Errors[]: {
            Id: string,
            Source: string,
            Message: string
        },
        Message: { *Method specific structure* }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET web service (using asmx...have not upgraded to WCF yet) that
I have ASP.NET website, and it calls the asmx web-service to do some operation
I have an ASP .NET web application which on the backend is talking to
I have a website created with ASP.NET and a web service, both using FormsAuthentication
I have created a ASMX Web Service which does some Active Directory stuff behind
I have a .NET web service which is publically accessible since it needs to
I have two ASMX web services consumed from javascript. The first service performs a
I have an ASMX web service which has a method - void DoSomething(List<string> list);
I have a small app which query our SharePoint server' Web Service interface for
I have an existing web service (ASMX) which exposes a service FooService with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.