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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:15:42+00:00 2026-06-18T01:15:42+00:00

I send in my app POST request to some URL. When I send it

  • 0

I send in my app POST request to some URL. When I send it for the first time, it´s OK, but when I call again method SendBookingFreeCapacity(), then I get

ApplicationUnhandledExceptionEventArgs in App.xaml in function "private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)".

Problem is line:

webRequest.BeginGetResponse(new AsyncCallback(GetBookingFreeCapacitydResponseCallback), webRequest);

Here is my code:

public static void SendBookingFreeCapacity() {
    var url = "https://..../getFreeCapacity";

    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
    webRequest.Method = "POST";
    webRequest.ContentType = "application/x-www-form-urlencoded";

    webRequest.BeginGetRequestStream(
        new AsyncCallback(GetBookingFreeCapacityRequestStreamCallback), 
        webRequest);
}

private static void GetBookingFreeCapacityRequestStreamCallback(
    IAsyncResult asynchronousResult)
{
    try {
        HttpWebRequest webRequest = 
            (HttpWebRequest)asynchronousResult.AsyncState;

        string postData = string.Empty;

        System.IO.Stream postStream = 
            webRequest.EndGetRequestStream(asynchronousResult);

        postData = "<?xml version=\"1.0\"?>" 
                   + "<request>" 
                   + "<login>" + Globals.Login + "</login>" 
                   + "<password>" + Globals.Password + "</password>" 
                   + "<hotId>" + htl.hotId + "</hotId>" 
                   + "<term>" 
                   + "<from>" + dayParser(Globals.PrijezdDate) + "</from>" 
                   + "<to>" + dayParser(Globals.OdjezdDate) + "</to>" 
                   + "</term>" 
                   + "</request>";

        byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);

        postStream.Write(byteArray, 0, byteArray.Length);
        postStream.Close();

        webRequest.BeginGetResponse(
            new AsyncCallback(GetBookingFreeCapacitydResponseCallback),
             webRequest); //after this I get the exception
    }
    catch (Exception ex) { }
}

private static void GetBookingFreeCapacitydResponseCallback(
    IAsyncResult asynchronousResult)
{
    try {
        HttpWebRequest webRequest =
            (HttpWebRequest)asynchronousResult.AsyncState;
        //some code...
    }
    catch (Exception ex) { }
}

Do you have some tips what can cause it? Where is problem?

  • 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-18T01:15:43+00:00Added an answer on June 18, 2026 at 1:15 am

    I founded the solution…create new page…

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

Sidebar

Related Questions

In my app, I have send some Request to server using POST Method and
Problem: From jQuery i send a post request to server, the url i call
In my app I send some intent extras from one activity to another. But
I need to send a POST request from a sinatra app to a rails
I'm attempting to send a multipart post request from an appengine app to an
In my app, I need to send all sorts of POST requests to a
I've got an iPhone App that is supposed to send POST data to my
I send 2 bytes of app data on the socket(blocking) every 10 seconds, but
In my app i have to send a xml data as request, I am
i have successfully set the app to send me to url like http://localhost:8000/log_in/?next=/task/1/ i

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.