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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:13:48+00:00 2026-05-13T09:13:48+00:00

How to download a word document which is stored in database, sql server as

  • 0

How to download a word document which is stored in database, sql server as a content data through C#?

This is my Code I’m using:

string doctype = dtResumeInfo.Rows[0]["ContentType"].ToString();
            string docname = dtResumeInfo.Rows[0]["FileName"].ToString();
            //
            try
            {
                Response.Buffer = false;
                Response.ClearContent();
                Response.ClearHeaders();
                Response.ContentType = doctype;
                Response.AddHeader("Content-Disposition",
                         "attachment; filename=" + docname);
                //
                //Code for streaming the object while writing
                const int ChunkSize = 1024;
                byte[] buffer = new byte[ChunkSize];
                byte[] binary = (dtResumeInfo.Rows[0]["ContentData"]) as byte[];
                MemoryStream ms = new MemoryStream(binary);
                int SizeToWrite = ChunkSize;

                for (int i = 0; i < binary.GetUpperBound(0) - 1; i = i + ChunkSize)
                {
                    if (!Response.IsClientConnected) return;
                    if (i + ChunkSize >= binary.Length)
                        SizeToWrite = binary.Length - i;
                    byte[] chunk = new byte[SizeToWrite];
                    ms.Read(chunk, 0, SizeToWrite);
                    Response.BinaryWrite(chunk);
                    Response.Flush();
                }
                Response.Close();
            }
            catch (Exception ex)
            {

            }

But, it is showing the following error:

SubStatusCode 'Response.SubStatusCode' threw an exception of type 'System.PlatformNotSupportedException'
 base {"This operation requires IIS integrated pipeline mode."} System.NotSupportedException  {System.PlatformNotSupportedException}
 Headers 'Response.Headers' threw an exception of type 'System.PlatformNotSupportedException'

My IIS version is 6.0 where I published. Donwloading word document can be done only in IIS 7. So, this is the cause of the error. Is there any other way to overcome this problem? Any other code will support lower version?? Plz, help me. (Sorry for long message.. )

  • 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-13T09:13:48+00:00Added an answer on May 13, 2026 at 9:13 am

    Problem is I’m using update panel in master page.. The UpdatePanel control uses asynchronous postbacks to control which parts of the page get rendered.So, I added following code to my button in aspx page.

    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                            <asp:Button ID="btnResumedload" Text="Download Resume" runat="server" BackColor="Maroon"
                                ForeColor="White" Font-Bold="true" OnClick="btnResumedload_Click" Height="27px"
                                Width="195px" />
    
                        </ContentTemplate>
                         <Triggers>
                                <asp:PostBackTrigger ControlID="btnResumedload" />
                            </Triggers>
                    </asp:UpdatePanel>
    

    It is working now.. Thank u very much 🙂

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

Sidebar

Related Questions

I have a piece of code that allow users download file from server (document
I have just written a Word Document creation web application using .NET 3.5 which
We're having a problem getting Word documents to download in IE7/IE8 using window.open calls.
I need to generate a ms-word document from a pl/sql query to export a
I have this Jquery AJAX request to process the creation of Word documents (using
My other programmer download this code from the net #import UIImage+Alpha.h // Private helper
So I wrote this short script (correct word?) to download the comic images from
I upload and download files from my desktop to a server for work using
I'm currently using a HttpResponse to download files from my Server. I already have
I am working on Asp.Net project which needs to fill in a word document.

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.