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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:35:52+00:00 2026-05-10T22:35:52+00:00

I originally used WebRequest and WebResponse to sent Http Post Messages. Always I got

  • 0

I originally used WebRequest and WebResponse to sent Http Post Messages. Always I got a response of ‘OK’. The message I post is an XML signed with a certificate in the xml.

The composition is this: C# service that is sending to a https website. HTTPS Website on another place that I cant say. HTTPS Local Website locally that is just receiving the messages I post locally and writing the results to a file. Just to simulate what the other website is getting.

Local Website is signed with a self signed certificate to expire in 2048.

This code was working fine until this week. I always posted and got an OK. In both websites. But this week the test and the real project implementation both go Kaput. On Both Websites.
On the local website it was saying unable to connect to SSL. This problem is caused by the self signed certificate that for some reason beyond my understanding its giving hell. Thanks to the questions here I just validated the certificate to always be true and now it is not bugging anymore.

To fix this just write this:

ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy(); 

In the start of your application. So that it only runs once.

The remaining problem is the ‘The remote server returned an error: (503) Server Unavailable.’. I enter the URL in my browser and it works fine for me. In the code this website is not receiving anything and when it goes to the web response it gives me the above error

I did a test application that only sends ‘Testing 1 2 3’ but I keep getting the error. I also sent it to a harvard https website and there was no errors.

private void btnSend_Click(object sender, EventArgs e)     {         try         {             WebRequest req = WebRequest.Create(cboUrl.Text);             req.PreAuthenticate = true;             req.UseDefaultCredentials = true;             req.Method = 'POST';             req.ContentType = 'text/xml';             String msg = txtMsg.Text;              using (Stream s = req.GetRequestStream())             {                 try                 {                     s.Write(                         System.Text.ASCIIEncoding.ASCII.GetBytes(msg), 0, msg.Length);                 }                 finally                 {                     s.Close();                 }             }              WebResponse resp = req.GetResponse();             StreamReader str = new StreamReader(resp.GetResponseStream());              txtRes.Text = str.ReadToEnd();         }         catch (WebException ex)         {             txtRes.Text = ex.Message;         }         catch (Exception ex)         {             txtRes.Text = ex.Message;         }      } 

This is another example I built from what I found in the internet:

private void button1_Click(object sender, EventArgs e)     {         try         {              HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(cboUrl.Text);             myReq.Headers.Clear();             myReq.Method = 'POST';             myReq.KeepAlive = false;             myReq.ProtocolVersion = HttpVersion.Version11;             myReq.ContentType = 'text/xml';             myReq.Proxy = null;             myReq.Credentials = null;             myReq.ContentLength = txtMsg.Text.Length;             using (StreamWriter sendingData = new StreamWriter(myReq.GetRequestStream()))             {                 sendingData.Write(txtMsg.Text);                 sendingData.Flush();                 sendingData.Close();             }              HttpWebResponse myResponse = (HttpWebResponse) myReq.GetResponse();             StreamReader responseStream = new StreamReader(myResponse.GetResponseStream());             txtRes.Text = responseStream.ReadToEnd();              responseStream.Close();             myResponse.Close();          }         catch(WebException ex )         {             txtRes.Text = ex.Message;         }         catch (Exception ex)         {             txtRes.Text = ex.Message;         }       } 

Update

Error was that the one I was calling with httpwebrequest, needed some httpheaders that I was not providing. Before the only thing that happened was that I got an ‘OK’ response. They fixed their code and I fixed mine and now its working.

If it happens to someone else check like the one below said the proxy settings and also check if the other side is giving an exception or returning nothing at all.

  • 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. 2026-05-10T22:35:52+00:00Added an answer on May 10, 2026 at 10:35 pm

    If you are not recieving a 503 error when navigating to the URL in your browser, but do recieve it when requesting the resource when using HttpWebRequest, the first thing I would recommend is that you specify a value for the UserAgent when making the request.

    You may also want to use Fiddler2 or another tool to get a better idea of what is happening during the lifetime of the request. It is hard to provide guidance without knowing more about the details of the service you are posting messages to.

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

Sidebar

Ask A Question

Stats

  • Questions 259k
  • Answers 259k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well I don't think this is going to work in… May 13, 2026 at 11:10 am
  • Editorial Team
    Editorial Team added an answer I think this is your problem: if input_quit == 'Quit':… May 13, 2026 at 11:10 am
  • Editorial Team
    Editorial Team added an answer The reason SetValue is not being called is that dependency… May 13, 2026 at 11:10 am

Related Questions

I'm trying to obtain an image to encode to a WordML document. The original
I'm deserializing a class called Method using .NET Serialization. Method contains a list of
I've been writing a little program for fun that transfers files over TCP in
I've been trying to improve my password hashing class for a CMS I'm currently

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.