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

  • Home
  • SEARCH
  • 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 8885287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:16:23+00:00 2026-06-14T21:16:23+00:00

In .NET 3.5, I had the following code: [WebService(Namespace = http://kitchenpc.com/schemas/)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

  • 0

In .NET 3.5, I had the following code:

[WebService(Namespace = "http://kitchenpc.com/schemas/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class KitchenPC : System.Web.Services.WebService
{
   [WebMethod]
   public LogonResult Logon(string username, string password)
   {
      //If username and password are not valid...
      throw new InvalidUsernameOrPasswordException();
   }
}

When I would call it, if I passed in an invalid username and password, the InvalidUsernameOrPasswordException would be thrown and I could catch the exception in Javascript by looking at error.get_exceptionType(). This is because the web service would serialize the exception info in JSON.

However, once I upgraded to .NET 4.5, this broke. Now, when I pass in an invalid username and password, I get the HTTP response:

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
jsonerror: true
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sat, 24 Nov 2012 22:42:33 GMT
Content-Length: 91

{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}

Basically, the exception type is lost and replaced with a generic error message.

What caused this behavior to change, and is there still a way to return exception information in JSON? Pretty much my entire API is designed to rely on this behavior.

  • 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-06-14T21:16:25+00:00Added an answer on June 14, 2026 at 9:16 pm

    Ah, this was a stupid issue. The exception information only appears if you have:

    <customErrors mode="Off" />
    

    In your web.config (under <system.web>). I’m actually not sure if this is a .NET 3.5 -> .NET 4.5 change in behavior, or if it got broke when I was re-writing my web.config build process using web.config transforms.

    Does anyone know if there’s a way to control this on a per web-service level? I’d rather not show full debug info on normal page requests.

    Update:

    I also came to the conclusion that throwing exceptions to communicate error information from a web service is really not a good design. In fact, I wrote a post on the subject on my blog for those interested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code setup: http://jsfiddle.net/bABHU/2/ Had to change it a little bit
I have the following code: http://jsfiddle.net/SPWWx/ I'm completely new to javascript, this is my
I had a run-time error when the following code was executed: (vb.net) dim q
i had used the following code in master page of asp.net project <a runat=server
I have following code on http://septicsecurity.com/facebook.html It used to work, but does not work
I had a problem with a COM component in .NET. It would instantiate but
I had the following code as per this question&answer How do I get the
Hai guys, I had the following code to send different mails to differnt users
I am trying to upload a file with ASP.NET MVC. The following code work
I'm getting an error when running the following code thru an ASP/ C# .NET

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.