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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:38:15+00:00 2026-06-08T09:38:15+00:00

I am wondering if there is a c# or selenium solution to the following:

  • 0

I am wondering if there is a c# or selenium solution to the following:

enter image description here

I am using selenium to download a file off a webserver.

unfortunately in IE9 there is no way to disable this popup screen.

is there a solution in c# for clicking on the SAVE button?

  • 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-08T09:38:17+00:00Added an answer on June 8, 2026 at 9:38 am

    Client

    WebClient client = new WebClient();
    byte[] file = client.DownloadData("http://domain.com/default.aspx");
    File.WriteAllBytes("helloworld.txt", file);
    

    Server

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            using (MemoryStream memory = new MemoryStream())
            using (StreamWriter writer = new StreamWriter(memory))
            {
                // The bytes written can be anything, does not have to be text
                writer.WriteLine("hello, world");
                writer.Flush();
                Response.BinaryWrite(memory.ToArray());
            }
    
            Response.AddHeader("Content-Disposition", "Attachment; filename=helloworld.txt");
            Response.AddHeader("Content-Type", "application/octet-stream");
            Response.End();
        }
    }
    

    As you can see with the above example, not only do I not know the physical location of the file, but there is no physical location! It is something I just wrote to memory and then wrote the raw bytes to the response, but WebClient.DownloadData() will still be able to download the bytes all the same. It doesn’t care where the bytes come from. Hope this helps.


    Additional Information:

    Some further background information further explaining why the above works.

    A browser’s primary job is to send HTTP requests and handle the response. Fortunately, they handle a lot of the grunt work for us. Showing a simple web page involves sending an HTTP-GET to the server and receiving bytes back in the response body, decoding those bytes into text, and parsing that text to render an HTML web page. It knows to handle the response like that because it has a Content-Type header of Text/HTML. While this is what it does most of the time, browsers can also handle other MIME types, if the Content-Type is text/plain it will decode the bytes and just display them without trying to parse it. Text/XML will usually allow you to collapse and expand XML nodes, etc. Again this is all dependent on how the browser is programmed to handle that particle MIME type.

    When you get a Save As dialog box in a browser, that is simply the browser’s way of handling a response with a Content-Disposition: Attachment header. This header tells the browser not to try to render or display the content, but to download it as an attachment instead.

    When you use the WebClient / HttpWebRequest classes, you are essentially writing your own miniature browser, however the implementation of how MIME types / HTTP headers are handled is entirely up to you. And this can allow you to save the bytes from a Content-Disposition response (or any response for that matter) without prompting with a Open or Save dialog box.

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

Sidebar

Related Questions

I'm just wondering, is there any way to run Selenium tests on Android in
I'm wondering if there's a (preferably built-in) way for Selenium hubs to ask for
Just wondering if there is a faster way to split a file into N
Just wondering if there is a way around this (or if it is even
Just wondering if there is a better way to write the following PL/SQL piece
Wondering if there is any way to get the lambda expressions that result from
Wondering if there is a good way to generate temporary URLs that expire in
just wondering if there is a way to reduce the amount of code needed
Just wondering is there any way I can check whether the url links to
Just wondering if there is any way to get the NS records in C#.

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.