By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,866 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,866 IT Pros & Developers. It's quick & easy.

Document file download problem asp.net

P: 3
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
Share this Question
Share on Google+
5 Replies


P: 3
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
Expert 5K+
P: 7,872
Correct your content type to match the type for a .doc file?
Oct 7 '09 #3

Frinavale
Expert Mod 5K+
P: 9,731
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

P: 3
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
Expert 5K+
P: 7,872
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

Post your reply

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