Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Can any one tell me how to create control to download word,xml, text ,jpg files.
Actualy there is one link in my application and onclick of that i want to open that file, but if it is word then do not display that opensavefiledialog and it will appear in some asp.net control.
I tried by using iframe but it fails...any one know any other control..

plz help me...
Posted
Updated 3-Jan-10 22:40pm

The issue is not in writing a control, it's in setting the mime type of the file when you send it, that will determine if the file is downloaded, or opened by Word. Of course, Word needs to be on the client machine.
 
Share this answer
 
Further to Christians answer.

The MIME type tells the browser what type of file is being transmitted so the correct application can be used to view the file.

To stop the open/save file dialog you will need to set the "content-disposition" header on the response to "inline" this will skip the open/save dialog unless there is no viewer for that MIME type in which case the open/save dialog will still open.
You are going to have to take control of the download process and not just link to the file.
 
Share this answer
 
hi,
I solved my issue using following code:
 
Share this answer
 
 
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