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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:21:47+00:00 2026-05-14T06:21:47+00:00

I have a webrequest that returns a html response which has form inside with

  • 0

I have a webrequest that returns a html response which has form inside with hidden fields with some javascript that submits the form automatically on pageload ( if this was run in a browser).

If I save this file as *.html and run this file in browser , the java script code automatically posts the form and the output is excel file.

I want to be able to generate this file(excel) from a c# code which is not running in broswer.

I tried mocking thr form post but its complicated and has various scenarios based on the original webrequest querystring. any pointers…. i know its not possible to probably run JS code that posts the form – from within c# code but still thought of chekcing if someone has done that.

  • 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-14T06:21:47+00:00Added an answer on May 14, 2026 at 6:21 am

    If I understand your question correctly, you have code in a web service that returns an HTML file that includes javascript which posts the form to somewhere that returns an Excel spreadsheet. Do I have this right?

    When your code becomes a Rube Goldberg machine, you might want to refactor a little. Is there any reason your original web request can’t be written to return an Excel spreadsheet (cutting out more than one middleman)?

    Update: Sorry about the Rube Goldberg crack – I think I understand your situation now.

    I would stay away from the WebBrowser for this purpose, as it’s more of an amusing but dangerous toy than a reliable link in a complex machine.

    Essentially, all you really need to do here is parse the HTML returned from your initial web request and extract the form values, then build your own form in code and submit it to the web service that returns an Excel spreadsheet. The javascript in the returned HTML is not actually of any importance to you, as its only purpose is to submit form values from a browser.

    Html Agility Pack looks like a good choice for this (I’ve never used it myself, but it appears to be the most frequent answer to this type of problem on StackOverflow).

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

Sidebar

Related Questions

I have the following GET request that returns HTML for a login form, indicating
I have response stream from a ftp web request that returns binary file. I
I have a console application which is parsing HTML documents via the WebRequest method
i have a product table which has a Title as string. inside my view
I have a class that goes and grabs some data and returns it as
I have a web request that can take 30-90 seconds to complete in some
I have a bunch of WCF REST services on Azure. Inside some of the
I have a web page that when navigated to only returns a simple text
I have a controller ActionResult that returns JSON that I would like to cache.
in my app I do a web request that returns some result code, e.g.

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.