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 8333007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:52:54+00:00 2026-06-09T02:52:54+00:00

I have a .Net server app (holding WCF REST JSONP service) and a javascript

  • 0

I have a .Net server app (holding WCF REST JSONP service) and a javascript application on client side.

To avoid cross-domain calls from javascript side we use JSONP for communication. To make our life easier with the javascript callbacks from server side we are using JavascriptCallbackBehavior: WCF is wrapping all the JSON responses in the callback function.

[JavascriptCallbackBehavior(UrlParameterName = "$callback")]
[ServiceBehavior(...)]
public class MySvcREST : ISvcREST
{
   public bool SvcMethod()
   {
      throw new WebFaultException<string>("ERROR!", HttpStatusCode.InternalServerError);
   }
}

IF I use the code above I will get the following response from my service:

HTTP/1.1 200 OK
Content-Length: 31
Content-Type: application/x-javascript
Server: Microsoft-HTTPAPI/1.0
Date: Fri, 03 Aug 2012 11:43:26 GMT

angular.callbacks._1("ERROR!",500);

EDIT1: Actually even if I remove the JavascriptCallbackBehavior and leave the default callback name, I would have similar effect, which is not very good.

I really want to get the HTTP 500 error code, not a HTTP 200 OK with the error inside.

How to solve my problem or is there another way to get JSONP from a WCF service?

  • 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-09T02:52:55+00:00Added an answer on June 9, 2026 at 2:52 am

    Unfortunately I didn’t get any reply to my question, but I found the following, somewhat useful, link: http://msdn.microsoft.com/en-us/library/ee816916.aspx .

    I understood that this behavior is by design… although from javascript side (jquery / angular js), at this time of writing, there is no way to read the second returned parameter (in my case, the http error code).

    So, in the end I am not sure if there is a solution other than a workaround. For now we return a CustomResult in which we include a custom error code and message.

    It is so disappointing with these web technologies when they don’t blend with each other… you are forced to so many workarounds.

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

Sidebar

Related Questions

I have an ASP.NET MVC server app and client code which uses jquery. I'd
I'm developing a new client-server app (.Net) and have up until now been using
I have created a .Net application to run on an App Server that gets
I have an asp.net MVC server on one side and a silverlight 4 client
I'm trying to adress the following issue: I have a server side .net application
Is there any ToDo app that have .NET api for server side adding tasks.
I have a client/server app. The server component runs, uses WCF in a 'remoting'
I have a client Server app that uses .NET Remoting. I have a helper
I have used SQL SERVER 2005 & c# .net for front end & app.config
I have asp.net mvc 4 web application project on my server in IIS Directory.

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.