Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET PDF File Damaged Error

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
Yes, I know there is a PDF forum. Unfortunately, they havn't been able to help me so I'm trying here.

Has anyone had problems in the past trying to display a pdf document?

I set my response.redirect to be the path of the pdf, and sometimes I get a "File damaged and could not be repaired" message. The pdf is fine (I can open it on the server no problem), so it seems to be a browser thing maybe?

Anyway, if you have any thoughts on this please let me know
Thanks!
:)

D'Arcy
 
Are your MIME types set correctly? Daren J. Lahey
Just another computer guy...
FAQ183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
Support your forums TODAY!
 
No, I hate mimes. If it doesn't have sound, I just can't get into the act.

Bud-dum-bum!

Seriously though, I'm not sure. We *think* we've found a solution though (which doesn't make sense, but...). Originally, we would click a link that would open a new window. The users would type in their info, then click a button to see the rendered pdf.

Now, the template stays in our main browser window, and when the pdf is done being created, they click a link to view IT in a new window. We havn't run into the nasty error since.

Go figure!
;)

But just for my own info, where would I check the MIME types?

Thanks Daren,

D
 
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(strName);
Response.Flush();
Response.Close();

That is to point to the correct MIME Type.
To set one up I would:
windows explorer - Tools - Folder Options - File Types
and create a new file type extension first
The browser automatically will find that new type and associate the right program with it. (i think lol)

good luck bro! Daren J. Lahey
Just another computer guy...
FAQ183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
Support your forums TODAY!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top