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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:59:41+00:00 2026-06-05T04:59:41+00:00

I have interesting task which requires me to download a dynamically generated file from

  • 0

I have interesting task which requires me to download a dynamically generated file from a server (ASP.NET) to the client. On the client side it is just JavaScript (jQuery) and the client is able to generate a lot of parameters to customize how the data is exported.

What is the best way to do download the file from the server? Should I use a WCF service such as what is described here or simple page like this one?

I don’t know how to download a file without reloading the page (I’m not sure that $.ajax will work in this case). Could someone please give me some direction on this topic? Thanks.

  • 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-05T04:59:43+00:00Added an answer on June 5, 2026 at 4:59 am

    First you can create the file from a handler .ashx

    Let say that you have the file for downloading at download.ashx and you have some parametres to pass from your javascript, eg download.ashx?p1=8827&p2=8831 to know what you going to create.

    Then on your javascript you simple can make a redirect as

    window.location = "download.ashx?p1=8827&p2=8831";
    

    or alternative you can use the window.open for do the same think

    window.open("download.ashx?p1=8827&p2=8831");
    

    and your file will start the download.

    Just make sure that you have set the header of attachment, and the correct contenttype on your handle eg:

      HttpContext.Current.Response.ContentType = "application/octet-stream";
      HttpContext.Current.Response.AddHeader("Content-Disposition", 
                        "attachment; filename=" + SaveAsThisFileName);
    

    Simple and clear, both tested and working.

    Also you may interesting on this answer: How to handle errors.

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

Sidebar

Related Questions

I have an interesting task: to write a program which captures input from the
I have an interesting problem when using partial page update in asp.net with scriptmanager
I want to download a huge file from an ftp server in chunks of
I have a very interesting task, which I don't know how to implement. I
I have an interesting scenario. I have a task model which has a task
I have an interesting problem. I have a page containing a Telerik chart which
I have a SwingWorker thread with an IOBound task which is totally locking up
I have a task, which I know how to code (in C#), but I
I have a task which I need to run in the background in my
I have an interesting situation - I have a table row which, currently, shows

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.