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

The Archive Base Latest Questions

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

How to organize a file downloading from server database and open it on the

  • 0

How to organize a file downloading from server database and open it on the client machine?

my code works only when the page is opened on the server:

        OracleCommand oracleCom = new OracleCommand();
        oracleCom.Connection = oraConnect;
        oracleCom.CommandText = "Select m_content, f_extension From " + Session["tableNameIns"] +
                                            " where i_id = " + rowData;
        OracleDataAdapter adapter = new OracleDataAdapter();
        DataTable tableD = new DataTable();
        tableD.Locale = System.Globalization.CultureInfo.InvariantCulture;
        adapter.SelectCommand = oracleCom;
        adapter.Fill(tableD);

        string FileName = Path.GetTempPath();
        FileName += "tempfile" + tableD.Rows[0][1];

        byte[] file = new byte[0];
        file = (byte[])tableD.Rows[0][0];
        FileStream fs = new FileStream(FileName, FileMode.OpenOrCreate, FileAccess.Write);
        fs.Write(file, 0, file.GetUpperBound(0) + 1);
        fs.Close();
        System.Diagnostics.Process.Start(FileName);
  • 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-13T23:26:06+00:00Added an answer on June 13, 2026 at 11:26 pm

    This is just not possible in a web application.
    If you want to do this, write a windows application.

    Security restrictions on a browser will not allow you to download and directly run an exe from a browser.
    You can send the exe in the response, where the user saves and runs it manually.

    In your current setting, the exe is still being written and run on the server, regardless of if the request comes from.

    Just a side note, its a lot easier to use WriteAllBytes to write byte arrays to files.
    You don’t have to worry about locks and disposing objects that way.

    File.WriteAllBytes(FileName, file);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I love to organize my code, so ideally I want one class per file
I need to organize mp3-streaming from my machine to the rest of the world.
I need to organize cache in mySql database for address - coordinates. What is
I'm doing some class clean to organize the functions in cs file in alphabetical
Sometimes I edit a file that represents a server restart. I would like to
In an attempt to organize my code, I'm trying to split up my (lengthy)
What is the best way to organize code that belongs to the same project
I come from a background where I normally create one file per class. I
I'm a bit anal about how I fold and organize my code in TextMate,
I'm trying to organize file with multiple sequences . In doing so, I'm trying

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.