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

  • Home
  • SEARCH
  • 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 6692275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:50:57+00:00 2026-05-26T05:50:57+00:00

I need to programatically send a form over POST. I have 4 fields, one

  • 0

I need to programatically send a form over POST. I have 4 fields, one checkbox and a submit button. how can i go about it?

  • 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-26T05:50:58+00:00Added an answer on May 26, 2026 at 5:50 am

    I use these functions assuming your question is about a forms application.
    You can call

    HttpPost(
        post_url, 
        "field_name_1", value_1,
        "field_name_2", value_2,
        ...);
    

    Here they are:

    public static string HttpPost(string url, params object[] postData)
    {
        StringBuilder post = new StringBuilder();
        for (int i = 0; i < postData.Length; i += 2)
             post.Append(string.Format("{0}{1}={2}", i == 0 ? "" : "&", postData[i], postData[i + 1]));
        return HttpPost(url, post.ToString());
    }
    public static string HttpPost(string url, string postData)
    {
        postData = postData.Replace("\r\n", "");
        try
        {
             WebRequest req = WebRequest.Create(url);
             byte[] send = Encoding.Default.GetBytes(postData);
             req.Method = "POST";
             req.ContentType = "application/x-www-form-urlencoded";
             req.ContentLength = send.Length;
    
             Stream sout = req.GetRequestStream();
             sout.Write(send, 0, send.Length);
             sout.Flush();
             sout.Close();
    
             WebResponse res = req.GetResponse();
             StreamReader sr = new StreamReader(res.GetResponseStream());
             string returnvalue = sr.ReadToEnd();
             return returnvalue;
        }
        catch (Exception ex)
        {
             Debug.WriteLine("POST Error on {0}\n  {1}", url, ex.Message);
             return "";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF app in which I need to programatically manipulate at runtime.
I need a way to programatically determine if this checkbox in control panel is
Scenario is I have a application relative url like ~/path/to/page.aspx?query=string. I need to programatically
I have a situation where I need to programatically select an option within a
I am having listview in linear layout, where I need to programatically add button.
We need to programatically burn files to CD in a C\C++ Windows XP/Vista application
I need to programatically determine whether .NET 3.5 is installed. I thought it would
I need to programatically append to a multi-page TIFF or PDF a new image.
I need to programatically encrypt a directory of files, like in a .zip or
I am in a need of programatically convert an Word-XML file into a RTF

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.