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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:05:02+00:00 2026-05-12T00:05:02+00:00

How to post the following HTTP requests in C# POST http://10.0.0.1/st_poe.cgi Accept: image/jpeg, application/x-ms-application,

  • 0

How to post the following HTTP requests in C#

POST http://10.0.0.1/st_poe.cgi

Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Referer: http://10.0.0.1/RST_st_poe.htm
Accept-Language: en-US
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: 10.0.0.1
Content-Length: 21
Connection: Keep-Alive
Pragma: no-cache
Authorization: Basic YWStaW47c3Jsa3NobQ==

ConMethod=++Connect++

I’m trying to do it with the following code. It is not working.

            string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + password));

            byte[] bytes = System.Text.Encoding.ASCII.GetBytes("ConMethod=++Connect++");

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://10.0.0.1/st_poe.cgi");

            request.Method = "POST";
            request.Headers.Add("Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*");
            request.Referer = "http://10.0.0.1/RST_st_poe.htm";
            request.Headers.Add("Accept-Language: en-US");
            request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)";
            request.ContentType = "application/x-www-form-urlencoded";
            request.Headers.Add("Accept-Encoding: gzip, deflate");
            request.ContentLength = bytes.Length;
            request.Headers.Add("Host: 10.0.0.1");
            request.Headers.Add("Connection: Keep-Alive");
            request.Headers.Add("Pragma: no-cache");
            request.Headers.Add("Authorization: Basic "+user);


            Stream reqStream = request.GetRequestStream();

            reqStream.Write(bytes, 0, bytes.Length);

            reqStream.Close();

Can anyone point out where I’m messing up. I’m using HttpWebRequest for the first time.

  • 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-12T00:05:03+00:00Added an answer on May 12, 2026 at 12:05 am

    You should perform the actual request with

    var response = request.GetResponse();
    

    Alternatively, you can use the simpler System.Net.WebClient class:

    var client = new WebClient();
    client.Headers["..."] = ...;
    // Use one of the DownloadXXX/UploadXXX methods.
    var responseBody = client.UploadData("Url", dataToUpload);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following POST request: POST http://blah/Request HTTP/1.1 Host: blah Content-Length: 322 Proxy-Connection:
I added TextToSpeech to my app, following the guidelines in the following post: http://android-developers.blogspot.com/2009/09/introduction-to-text-to-speech-in.html
I have the following code that works on PHP5 to send a HTTP POST
I am trying to build a webservice that manipulates http requests POST and GET.
My problem is the following... I read about sending http requests and receiving their
I'm trying to POST the following xml to a server url, but i don't
I can't seem to receive HTTP OPTIONS requests in my IIS6 hosted ASP.NET application.
I'm trying to POST HTTPS requests using a PEM certificate like following: import httplib
I am attempting to lock down a page to only accept POST requests. as
I have written a simple http server to handle POST requests: class MyHandler( BaseHTTPServer.BaseHTTPRequestHandler):

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.