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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:53:30+00:00 2026-05-27T06:53:30+00:00

I am saving a .doc file to a SQL Server database as varbinary(max) using

  • 0

I am saving a .doc file to a SQL Server database as varbinary(max) using the C# code below.

I am able to save the file, but when I retrieve the file back and want to display the contents on the web page, my code is downloading the file and I am in great confusion about how to handle it.

The exact functionality I am looking for is the way naukri.com uploads the resume and gives a preview of it. My code is :

byte[] fileContent = new byte[fuResume.PostedFile.ContentLength];
fuResume.PostedFile.InputStream.Read(fileContent, 0, fuResume.PostedFile.ContentLength);
//lblAppliedMessage.Text = ByteArrayToString(fileContent);

//lblAppliedMessage.Text = BitConverter.ToString(fileContent).Replace("-", string.Empty);
byte[] btYourDoc;
btYourDoc = fileContent;

Response.ContentType = "application/ms-word";
Response.AddHeader("Content-Disposition", "inline;filename=yourfilename.doc");
Response.OutputStream.Write(btYourDoc, 0, fileContent.Length);

Response.BinaryWrite(btYourDoc);

Response.End();
  • 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-27T06:53:31+00:00Added an answer on May 27, 2026 at 6:53 am

    squillman is right. There are tons of third party components that do Word -> HTML conversion.

    One other option, which may be more appropriate for an intranet site, is to install Word on the server.

    An example of this is here:

    http://www.c-sharpcorner.com/UploadFile/munnamax/WordToHtml03252007065157AM/WordToHtml.aspx

    Effectively, the doc is opened, saved out as HTML, then subsequent requests can retrieve the HTML version of the file for preview.

    Office automation server side has many pitfalls, however – see http://support.microsoft.com/kb/257757 for more information.

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

Sidebar

Related Questions

Currently we are saving files (PDF, DOC) into the database as BLOB fields. I
I am saving something in doc but it adds html to it <? header(Content-type:
Im using the accepted answer here: Transmit generated XML file without saving to disk
When we try to save msword doc file as html file we get wmz
My Code: // Read in Xml-file XmlDocument doc = new XmlDocument(); doc.Load(C:/Web.config); XmlNode d
I am trying to save drafts using NSUserDefaults but I am not sure if
Saving data to Postscript in my app results in a Postscript file which I
When saving data in different sql tables, is it best to use the GUID
After saving a String value into memcached using the Danga client, I attempted to
I'm having trouble saving a new row in the DataGridView back to the database.

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.