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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:27:51+00:00 2026-05-24T07:27:51+00:00

I am currently calling a webservice from an ASP.net page. I am trying to

  • 0

I am currently calling a webservice from an ASP.net page. I am trying to call a REST based web service to request a certain action and a 404 is returned (which represents a specific error for my application). I try to catch the error but as a 404 is returned my application instead continues to hang and I end up catching the following error.

[System.Net.WebException] = {“The underlying connection was closed: An unexpected error occurred on a receive.”}

Why would I catch a different error over 2 seconds after the web service responds with a 404?

try
{
    newPassword = Customer.ResetPassword(_transaction.Centre.Id, newPassword);
}
catch(WebException ex)
{
    HttpWebResponse response = (HttpWebResponse)ex.Response;

    if ((response != null) && (response.StatusCode == HttpStatusCode.NotFound))
    {
        //then the email address doesnt exist
        ErrorPage(104);
    }
    else
    {
         ErrorPage();
    }
 }
 catch (Exception ex)
 {
    ErrorPage();
 }

and that calls this:

Request currentRequest = new Request(uri,
            Communication.Request.HttpRequestType.POST,[hidden][hidden]);

Response response = currentRequest.Send(Serializer.Serialize<ResetPassword (resetPassword));

return Serializer.Deserialize<ResetPassword>(response.BodyData);

Please ignore the [hidden] tags. Ive had to hide that from public view. However, I hope that helps.

Thank you all for your help!

  • 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-24T07:27:52+00:00Added an answer on May 24, 2026 at 7:27 am

    Since you’ve provided little information about your system:

    You are probably terminating your web service call early with something like

    HttpContext.Current.Response.End()
    

    The webservice code (in .NET) is probably trying to complete the request but you’ve closed the connection early. This happens with Response.Redirect() too but you never see it on the web-side because you’ve already completed the output to the user. It’s not related to your 404. The web-service code throws the WebException but there’s nothing to handle / format the output.


    Update

    Based on your feedback I can only deduce that your problem is probably either:

    1. In the Data sent to the webservice
    2. In how the webservice handles the data

    You should download Fiddler2 and sniff the http request to your webservice to verify what’s actually going across the wire. If everything checks out then there’s only 2 things I can think of:

    1. Something about your Request/Response is not right. You could use a WebClient Instead and call either UploadData(...) or UploadString(...) to transmit your data to the webservice.
    2. Something is wrong in the webservice that’s causing it to close the connection before terminating the response the way your client expects it.

    WebException: The underlying connection was closed: An unexpected error occurred on a receive. Should only happen when the client expects to recieve data (like a body after a header) but the server terminates the response early.

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

Sidebar

Related Questions

I've got a web service (ASP.NET 2.0) that I'm calling from javascript using jQuery's
I'm trying to call an ASP.NET .asmx webservice, from javascript, using other than the
I'm currently calling a web service from my J2ME app and receiving the xml
I am calling an axis web service from WCF. The request works just fine
I am a noob to ASP.NET/C#. I am trying to use a web service
I'm calling a web service from an Apache Axis 1.4 Java client. The call
I am currently calling a ColdFusion web service in C#. The web service is
Hi All I am currently having an issue calling a WCF service from a
I'm using a web service with an ASP page. I'd like to keep most
I'm having a big problem when calling a web service from my WPF 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.