.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
ASPEvil
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Post New Web Links

DOCX FILE CORRUPTED WHEN RETRIEVED FROM SQL2005

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :ASP.Net
 

I am saving .docx file to database,  the content type for .docx is :-application/vnd.openxmlformats-officedocument.wordprocessingml.document

but whil opening .docx file its giving error as

The file"abc.docx" cannot be opened because there are problem with content.

Details: The file is corrupt and can not be open.

but when chicking ok its opening the correct content.

My code is:

               Response.Clear();
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
                Response.ContentType = contenttype;
                Response.OutputStream.Write(filedata, 0, filedata.Length);

Help!

Thanks




View Complete Post


More Related Resource Links

Get .doc or .docx file from Directory

  

Hi,

I want to get files(.doc,.docx) from Directory and show the Content with formatting in a webform.
Is there any solution?
Please help me.

Thanks in advance.


Directory.Move leads to corrupted 'file'

  

Hello All,

 

I have earlier used Directory.Move to move one folder into an existing sub folder. The path I specified happened to have a slightly different case to the existing directory (temp vs Temp), and the result is two folders, one called temp the other Temp. Normally we can't do this through windows as it recognises the two folders to ultimately have the same name regardless of case. I expected the .NET class to handle in the same way.


I've deleted the original Temp folder, but this 'temp' directory still remains... it's recognised by Windows as a directory yet also reported as not existing! Whilst I could probably live with a redundant corrupt file somewhere on my disk it's really causing some problems with recursive functions that, like the rest of windows, get confused by the directory which exists but doesn't exist.

Has anybody had this same problem? Or rather, how can I fix this?

 

Running VS2008 on Win7.

 

Regards,

Chris


The file or directory is corrupted or unreadable

  

Hi,

I have installed a two node active/passive sql 2005 cluster on windows 2003 in vmware workstation environment . the cluster installed successfully (configured the cluster according to the link "http://www.bradspace.net/blog/kb/?p=91&more=1&c=1&tb=1&pb=1"). but when I try to move sql server resource group to passive node, it gets fail by logging following error message in event log "initerrlog: Could not open error log file 'G:\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG'. Operating system error = 1392(The file or directory is corrupted and unreadable.)."

I have taken sql resources group offline and manually moved only sql server shared drive to other node and i have found that i am not being able to access error log or any other folder including data on node 2. the operating system shows a error saying that disk is corrupted. I have run chkdsk which delete's all the files of sql setup.

I re-installed sql server, but again found the same problem . by wo

The file or directory is corrupted or unreadable

  

Hi,

I have installed a two node active/passive sql 2005 cluster on windows 2003 in vmware workstation environment . the cluster installed successfully (configured the cluster according to the link "http://www.bradspace.net/blog/kb/?p=91&more=1&c=1&tb=1&pb=1"). but when I try to move sql server resource group to passive node, it gets fail by logging following error message in event log "initerrlog: Could not open error log file 'G:\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG'. Operating system error = 1392(The file or directory is corrupted and unreadable.)."

I have taken sql resources group offline and manually moved only sql server shared drive to other node and i have found that i am not being able to access error log or any other folder including data on node 2. the operating system shows a error saying that disk is corrupted. I have run chkdsk which delete's all the files of sql setup.

I re-installed sql server, but again found the same problem . by wo

Reading Data From File Gets Corrupted

  

I am reading data from a TXT file that requires me to replace some of the existing data, and then write it back to the file.  The issue is, there are special characters in the file that get corrupted when I write the text back to the file.

For example, I have a string in a file "foo.txt" that has the following "?rdrf  +À [HIGH]".  My application reads the text into a string, goes through the line and replaces [HIGH] with a value, and then writes back to the file.  The issue is, the special text characters get corrupted.

Here is an abbreviated version of the code base:

string fileText = System.IO.File.ReadAllText("foo.txt");
fileText= iPhoneReferenceText.Replace("[HIGH]", low);
TextWriter tw = new StreamWriter

Cannot drop filegroup from Database in case when the file, asociated with it, is corrupted

  
Hi,
I have the following problem:
Have a DB with 4 filegroups with patition function and schema and one table attached to the schema. After restarting the SQL Server one of the ndf files become corrupted. I don't have backup. I set the filegroup offline and set the DB to multiuser, but I cannot remove the filegroup or file attached to the filegroup or rename the filegroup. It is not recomended to transfer the data to the new table with new schema. Does anybady has an idea how to solve this issue?
Vt - MCTS

File Splitter in .Net

  
I love to do utility programs in .Net. And this is one of them. As I was playing with JSplit (a free file splitter program), I wondered if I could do it in .Net. The framework supports file operations like reading files in bytes and creating them. It is indeed easy to do file operations in .Net Basics on File operations

Upload Multiple File using JQuery in asp.net

  
In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

Creating Excel file from C#

  
I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is

Upload a File to a SharePoint Document Library - Part I

  
The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

SmtpClient and Locked File Attachments

  
Got a note a couple of days ago from a client using one of my generic routines that wraps SmtpClient. Apparently whenever a file has been attached to a message and emailed with SmtpClient the file remains locked after the message has been sent. Oddly this particular issue hasn't cropped up before for me although these routines are in use in a number of applications I've built.

How to call an .exe file in .net

  
Sometimes a developer has to call an EXE from another EXE. While calling EXE there can be a requirement to pass parameter.

ClientAccessPolicy file in SharePoint 2010

  
I am upgrading my Silverlight demo code from the old beta to beta 2 and see that there are a few new considerations for the deployment of ClientAccessPolicy.xml files. In a previous post I demonstrated how to do this for SharePoint 2007. The heartburn that I get with that approach is any site collection owner or designer can drag the file into the site collection and open the site up to unwanted client access issues. In 2010 the virtual path provider no longer serves the files from the root of the site collection

Multi File Upload Using JQuery!

  
Everyone knows about the file upload in .NET. But the multi file upload is some what difficult in .NET. For that purpose we can have some AJAX or JQuery!. Jquery is the latest advanced version. It will give some animated upload. You can try it for your own!!!!

Transfering a file from Conputer to PDA

  
You can transfer one file at a time between your computer and another Bluetooth device by using the Bluetooth File Transfer Wizard. For example, you can transfer files between your computer and a mobile phone or a PDA. You can also transfer files between two computers that use Bluetooth.

The Free Barcode Creator produces barcode images one at a time, and allows easy saving to a file or

  
The Free Barcode Creator produces barcode images one at a time, and allows easy saving to a file or pasting into an application. 2D versions are also available:
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend