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

  • Home
  • SEARCH
  • 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 6761063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:08:30+00:00 2026-05-26T14:08:30+00:00

I upload BLOB files in my SQL database. I create Dynamic Hyperlink redirecting to

  • 0

I upload BLOB files in my SQL database. I create Dynamic Hyperlink redirecting to my downloading.aspx.cs , to download the files .

When I click on it , the only thing I retrieve is something like that :

*����JFIF,,��ExifMM*�   ���(1�2;%+>P?`���7��i��%��NIKON CORPORATIONNIKON D3-��'-��'Adobe Photoshop CS4 Macintosh2010:11:19 21:53:25 9�I�@d!ddGddd+�K�r� (��Ƃ�Έ"�'@�0221�֐����� ���� � ��,��42��42��42�0100����Р�d����J����R�b����   � ��Z @( 2010:11:19 20:44:392010:11:19 20:44:39 � ASCII  R030100��(�HH����JFIFHH��Adobe_CM��Adobed����* 

This is my Page_Load code in this downloading.aspx :

protected void Page_Load(object sender, EventArgs e)
{
    string filename = Request["file"].ToString();
    var conString = ConfigurationManager.ConnectionStrings["LocalSqlServer"];
    string strConnString = conString.ConnectionString;
    SqlConnection dbConnection = new SqlConnection(strConnString);
    dynamic queryString = ("SELECT Data FROM Files WHERE Name = '" + filename + "'");
    SqlCommand theCommand = new SqlCommand(queryString, dbConnection);
    dbConnection.Open();
    SqlDataReader reader = theCommand.ExecuteReader();

    if (reader.Read() && reader != null)
    {
        Byte[] bytes;
        bytes = Encoding.UTF8.GetBytes(String.Empty);
        bytes = (Byte[])reader["Data"];
        Response.BinaryWrite(bytes);

        reader.Close();
    }

    dbConnection.Close();
}

Can someone tell me why? Thank you.

  • 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-26T14:08:30+00:00Added an answer on May 26, 2026 at 2:08 pm

    You need to set content type, and add content disposition to your response headers as so:

    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
     Response.AddHeader("content-disposition", "attachment;  filename=whatever.xlsx");
     Response.BinaryWrite(yourbytes);
    

    Note: content-type has to be specific to the type of file you are streaming. If an image, it has to be something like “image/jpg”; etc. Similarly for the header; if it’s an image, probably you want to set the extension on the filename part to be “file.jpg”. Above code is just an example

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

Sidebar

Related Questions

I want to upload some files of size 35MB on to the blob container.
I wanted to knw if there is way we can upload /download a blob;
Is it a good idea to store video files in a database as BLOB
Say I let users upload files to my server, and I let users download
I have a little question .. I am using blob to upload my files
we store image files into database as BLOB type, but i have to save
I have a legacy VB6 application that uploads file attachments to a database BLOB
I upload image files using aspupload component. I was wondering if its possible to
When I upload an image file to a blob, the image is uploaded apparently
I'm going to incorporate the feature for my users to upload small files which

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.