473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Document file download problem asp.net

I have face the problem When download .doc file this is corrupted
Please Help me.
my code is :
Expand|Select|Wrap|Line Numbers
  1. String FileName = Request.QueryString["name"];
  2.  
  3.             StreamReader sr = new StreamReader(Server.MapPath("cv/" + FileName));
  4.             String data = sr.ReadToEnd();
  5.             Response.Clear();
  6.             Response.ContentType = "application/x-unknown";
  7.             Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
  8.             Response.Write(data);
Oct 6 '09 #1
5 3517
I have faced this problem when download the .doc file this is ok but this file is corrupted
my Code is :
Expand|Select|Wrap|Line Numbers
  1. String FileName = Request.QueryString["name"]; 
  2.  
  3.             StreamReader sr = new StreamReader(Server.MapPath("cv/" + FileName)); 
  4.             String data = sr.ReadToEnd(); 
  5.             Response.Clear(); 
  6.             Response.ContentType = "application/x-unknown"; 
  7.             Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName); 
  8.             Response.Write(data); 
  9.  
  10.  
any one please help me
Oct 7 '09 #2
Plater
7,872 Expert 4TB
Correct your content type to match the type for a .doc file?
Oct 7 '09 #3
Frinavale
9,735 Expert Mod 8TB
Please do not double post your questions.
It makes it difficult for you to get an answer if you are getting help from several different places.

I have closed this thread.
Please refer to your other thread for more help on the topic.
Oct 7 '09 #4
I have faced this problem when download the document file this is OK but this file is corrupted
my Code is :
Expand|Select|Wrap|Line Numbers
  1. String FileName = Request.QueryString["name"]; 
  2.  
  3.             StreamReader sr = new StreamReader(Server.MapPath("cv/" + FileName)); 
  4.             String data = sr.ReadToEnd(); 
  5.             Response.Clear(); 
  6.             Response.ContentType = "application/x-unknown"; 
  7.             Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName); 
  8.             Response.Write(data); 
  9.  
  10.  
any one please help me
Oct 10 '09 #5
Plater
7,872 Expert 4TB
That is THREE threads of the same question I have merged.
Please do not double(or triple) post your questions.
MODERATOR

Help was already being attempted in response to one of them.
Oct 12 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: W.Guerlich | last post by:
I've got a Java servlet that delivers large database resultsets transformed to Excel with the HSSF library. In some cases it takes more than 15 minutes before transformation is done and content can...
2
by: Suzanne Boyle | last post by:
I have some javascript code in my page that calls the document.getElementById method. This usually works fine however in IE 6, after I have downloaded a file using the File Download dialog, I get...
4
by: gb | last post by:
hi, i placed System.Windows.Forms.WebBrowser in my WinForm. When i tried loading word document, it opens the File Download window. My question is how can i avoid the File Download window from...
18
by: jmd | last post by:
Hello, I posted the following in the C# forum but without one answer. But perhaps now in vb.net someone has some guidelines ! This is my question : I want to write a vb.net program that does...
2
by: standish22 | last post by:
I want to open a word document stored in my database. What I do is save the document locally, and then open a new winform that has the WebBrowser Control on it and navigate to that new file. ...
5
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. ...
0
by: bill | last post by:
Hi All, I have built an application that allows a user to download a file from the server. I would like to come up with a solution that works with all html standard compliant browsers in...
1
by: ckarbass | last post by:
I'd like for the file download dialog to be launched upon page load. The workflow or behavior is exactly the same as sourceforge's. I've searched on google to no avail. Any help would be...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.