Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am stucked with an issue that, i am writing a pdf file using Response.writefile() method and it is working in from ie6 to ie10 in local machine with visual studio, but not working in from ie8 to ie10 on production server. the code i used is

Dim fi As New FileInfo(Server.MapPath(../temp/ChequeBounceLetter- & SessionId &.pdf))
If fi.Exists Then
Response.ClearContent()
Response.ContentType == "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name)
Response.AddHeader(Content-Length, fi.Length.ToString())
Response.WriteFile(fi.FullName)
Response.End()

Pls suggest me some ideas .... thanks in advance
Posted

1 solution

C#
// Try This :
byte[] fileBytes = File.ReadAllBytes(fi.FullName);
Response.Clear()
Response.ContentType == "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name)
Response.AddHeader(Content-Length, fileBytes.Length.ToString());
Response.BinaryWrite(fileBytes);
Response.End();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900