Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB
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 29-Dec-09 21:18pm
Edited 3-Jan-10 23:40pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

hi,
I solved my issue using following code:
<meta name="DownloadOptions" content="nosave"/>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

<meta name="DownloadOptions" content="nosave"/>
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 4 Jan 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100