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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:04:39+00:00 2026-06-01T00:04:39+00:00

I have a Web page within my application that needs to call a web

  • 0

I have a Web page within my application that needs to call a web service I have set up to return a list of objects. This call is set up like so

$(document).ready(function() {
    var response = $.ajax({
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        url: '/Ajax/service.asmx/GetObjects'
    });

    response.success(function(data) {
       $('#bodyText').html(data);
    });

    response.complete(function() {
       alert('ajax complete');
    });

});

My service looks like this

namespace AjaxTest.Ajax
{
    #region
using System.ComponentModel;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
using System.Web.Services;

#endregion

/// <summary>
/// Summary for boat
/// </summary>
[WebService(Namespace = "http://quality/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class Boat : WebService
{
    #region Public Methods and Operators

    /// <summary>
    /// The Get Models method.
    /// </summary>
    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public void GetModels()
    {
        var models = Com.somedll.GetModels();
        var serializer = new JavaScriptSerializer();
        var response = models.Count != 0
                ? serializer.Serialize(models)
                : serializer.Serialize(new Error { Code = "500", Message = "Model Retrieval Failed" });
        this.Context.Response.Clear();
        this.Context.Response.ContentType = "application/json";
        this.Context.Response.Flush();
        this.Context.Response.Write(response);
    }

    #endregion
    }
}

I am getting the following errors Server cannot append header after HTTP headers have been sent.
and looking at Firebug the request seems to be being sent multiple times at least 4 for each request, can anyone help. Please let me know if you need any more information

  • 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-01T00:04:41+00:00Added an answer on June 1, 2026 at 12:04 am

    Move your Response.Write call before your call to Flush.

        this.Context.Response.Write(response);
        this.Context.Response.Flush();
    

    UPDATE: You can also try removing the ContentType setter, since you’re already stating that your response type is JSON.

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

Sidebar

Related Questions

I have an Android application that has one section loading a web page within
We have an application that reconstructs external web sites in an Iframe from within
I have a web application that our product owner has stated must respond within
For an Intranet application I have a web page save function that can lead
I have a .net web service that takes some xml data. From within the
I have a div within a div, and when viewing the web page in
I have a web page that includes a bunch of images. Sometimes the image
I have a web page with DIV s with a mouseover handler that is
I have a web page that displays a long line graph inside a div
I would like to log errors/informational and warning messages from within my web application

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.