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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:05:44+00:00 2026-06-13T10:05:44+00:00

I POST to website’s JSON-response URL using WebBrowser.Navigate() . All goes well, including the

  • 0

I POST to website’s JSON-response URL using WebBrowser.Navigate().

All goes well, including the webBrowser1_DocumentCompleted() event handler being called.

But instead of getting a “quiet” response (e.g. webBrowser1.Document) that I can handle programmatically, I receive a File Download dialog box:

enter image description here

If I click the Save button and later examine the file, it contains exactly the JSON response that I expect.

But I want the program capture this JSON response in-code, without displaying that dialog and having to click the Save button.

How do I capture JSON response using WebBrowser control?

Note: before posting this question I searched SO and all I found was a similar question for which the accepted answer doesn’t really explain how to do this (I’m already handling webBrowser1_DocumentCompleted). Any tips?

Update: All my searches so far yielded nothing in regard to using WebBrowser control to fetch JSON responses. Perhaps I am approaching this completely wrong? What am I missing?

  • 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-13T10:05:46+00:00Added an answer on June 13, 2026 at 10:05 am

    Don’t use WebBrowser for JSON communication. Use WebRequest instead:

    //
    //    EXAMPLE OF LOGIN REQUEST 
    //
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Net;
    using System.IO;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                // Create a request using a URL that can receive a post. 
                WebRequest request = WebRequest.Create("http://getting-started.postaffiliatepro.com/scripts/server.php");
                // Set the Method property of the request to POST.
                request.Method = "POST";
                // Create POST data and convert it to a byte array.
                //WRITE JSON DATA TO VARIABLE D
                string postData = "D={\"requests\":[{\"C\":\"Gpf_Auth_Service\", \"M\":\"authenticate\", \"fields\":[[\"name\",\"value\"],[\"Id\",\"\"],[\"username\",\"user@example.com\"],[\"password\",\"ab9ce908\"],[\"rememberMe\",\"Y\"],[\"language\",\"en-US\"],[\"roleType\",\"M\"]]}],  \"C\":\"Gpf_Rpc_Server\", \"M\":\"run\"}";
                byte[] byteArray = Encoding.UTF8.GetBytes(postData);
                // Set the ContentType property of the WebRequest.
                request.ContentType = "application/x-www-form-urlencoded";
                // Set the ContentLength property of the WebRequest.
                request.ContentLength = byteArray.Length;
                // Get the request stream.
                Stream dataStream = request.GetRequestStream();
                // Write the data to the request stream.
                dataStream.Write(byteArray, 0, byteArray.Length);
                // Close the Stream object.
                dataStream.Close();
                // Get the response.
                WebResponse response = request.GetResponse();
                // Display the status.
    //            Console.WriteLine(((HttpWebResponse)response).StatusDescription);
                // Get the stream containing content returned by the server.
                dataStream = response.GetResponseStream();
                // Open the stream using a StreamReader for easy access.
                StreamReader reader = new StreamReader(dataStream);
                // Read the content.
                string responseFromServer = reader.ReadToEnd();
                // Display the content.
                Console.WriteLine(responseFromServer);
                // Clean up the streams.
                reader.Close();
                dataStream.Close();
                response.Close();
    
    
            }
        }
    }
    

    You can find more details in this C# .NET communication with API article and this thread.

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

Sidebar

Related Questions

this is my first post on this website, but I'm all the time getting
I am using Ajax to post the comments of the website. No the user
this is my second post on the website. Of all other sites i tried,
Currently I'm wondering if there is a way to post to a website using
I basically am tasked with scraping a website using a post request. I was
You know if you were to post you website into a status or comment
GET is a convenient method to post the form id, post the website id
this is my first post on this website, Anyway, I recently started trying to
It's pretty simple, I have a text area post on my website, and if
In the website every product is a post, but when we add new products

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.