473,594 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to force download

Hi

I have a link on a page that points to a file inside the site that I want to
be downloaded
loke in page_load I write

linkFile.Naviga teUrl = Request.Applica tionPath + "/somepath/file.iif";

This file is a text file so when user clicks onthat link it displays in the
browser
the contents of that file (it is a text file although with ext iif)

How do i force browser to display dialog like where to save it?

Thanks
GSL
Nov 19 '05 #1
1 1544
Yes, you can force a dialog box that will ask the user whether they'd like
to open or save the file:

Response.Clear( )
Response.Conten tType = Whatever
Response.Writef ile("c:\whateve r.iif")
Response.AddHea der("Content-Disposition",
"attachment;fil ename=whatever. iif")
Response.End()

Here are more details:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"greg" <in**@ebsdevelo pmentNOSPAM.com > wrote in message
news:OV******** ******@TK2MSFTN GP15.phx.gbl...
Hi

I have a link on a page that points to a file inside the site that I want
to
be downloaded
loke in page_load I write

linkFile.Naviga teUrl = Request.Applica tionPath + "/somepath/file.iif";

This file is a text file so when user clicks onthat link it displays in
the
browser
the contents of that file (it is a text file although with ext iif)

How do i force browser to display dialog like where to save it?

Thanks
GSL

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5229
by: Matthew Sims | last post by:
Is it possible to force a download without using the readfile function? My website setup consists of my server that serves the web pages plus a high-speed file server elsewhere on the internet that servers my files. I'm currently using header("Location: abc.com") to redirect my users to this other site but can't force a download. I can get it to work using readfile() but that means the file moves from the high-speed server through my...
2
12633
by: Jonathan Driller | last post by:
I am attempting to block repeat downloads from a site. I need to have a landing page pass a referer to a secured page. I have tried a meta refresh redirect and several Javascript redirect strategies but none pass the referer. How can I force this since the referer property is read only? I have set up an .htaccess file so it will only let people into a secure directory if they come from an internal page on my site. This is done by...
0
1207
by: Jake | last post by:
How can I force an image download with IE using ASP.net?? Here is the catch: the image I want to force a write with is located on another web server. I can only reference the image with a URL. If the image is on my machine, I use the response.wrifefile method. After setting up my headers I can force an image download. However, I can't get this to work if I reference the image via a url.
2
4461
by: JP SIngh | last post by:
Hi All I am creating an asp application which is essentially a file management app. I am trying to get my head around a technically issue wonder if someone can offer some help. I want to be able to force the download of the files are attached to a particular record.
4
21932
by: Kevin Muenzler, WB5RUE | last post by:
How do I force a browser to download a file instead of displaying it? In other words I have a page with MP3 and WMA files on it and I would like for the visitor to download the file instead of play it without having to right-click and save. How can I force the browser to pop up the "save file as" dialog box instead of playing it? I know that I can encapsulate it in a zip file which will download and open WinZip. Thanks
4
1697
by: tma | last post by:
Short of zipping my file, are there any other alternatives to the below? I'm trying to add anchors in code and I need the link to force a download of the .pdf rather than open a new window or worse, open the file in the current client browser window. Is there something I can change about the anchor itself to force this behavior? I did not have any success with the "content-disposition" articles suggested. Here is my very normal anchor...
0
2656
by: comp.lang.php | last post by:
I have a form that when you click the "Generate Report" submit button, it will force download a CSV file, required for this project. On the very same page you also have a "Search" submit button, when you press it it should generate search results in a new page. However, when you click the "Generate Report" submit button, the moment you try to THEN click the "Search" submit button, the "Search" submit button NEVER goes to a new page but...
2
2300
by: comp.lang.php | last post by:
class ReportGenerator { function ReportGenerator() {} /** * Generate the HTTP headers necessary for this file type. Can be called statically *
3
2455
by: Bouffa | last post by:
Hello everyone, I suppose you all know force-download scripts. The problem is that these scripts don't allow files to be splitted when downloading them via a download manager. I've found a solution to enable download resuming, but now, it remains the splitting problem. Does anyone have any idea ?
0
2660
by: jinnareddy | last post by:
Hi, I'm unable to download a file that is having a 2-byte char in its name (e.g.テ) using force download option. Though, am able to download file names involving ASCII chars. I have tried URL encoding too, but with no success. Can someone provide details on how to handle the 2-byte char URLs and download the files? Appreciate your suggestions/help in resolving it. Here is my code:
0
7877
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8253
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8009
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3867
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.