473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Download, is it correct?


Web application has the following code for downloading a file from a server

this.Context.Response.Clear();
this.Context.Response.BufferOutput = false;
this.Context.Response.ContentType = "application/octet-stream";
this.Context.Response.AddHeader("Content-Disposition","attachment;
filename=" + FileName);
// this.Context.Response.AddHeader("Content-Length",fileSize.ToString());
this.Context.Response.Flush();
this.Context.Response.WriteFile(FullFileName);
// this.Context.Response.Flush();
// this.Context.Response.End();

It runs after a button on a page is clicked.
The code apparently never worked. Code is being executed without errors but
nothing happens.
I checked some examples and they were more or less as the above code.
What could be wrong?
What should I expect with working code - the download dialog box?

Thanks

MH
Jul 21 '05 #1
1 1420
What if you try a page with :

this.Context.Response.AddHeader("Content-Disposition","attachment;filename=m
yfile.txt");
this.Context.Response.Write("Hello World");

Make sure to clear the HTML the page may contains. From there you should be
able to add back more things until to find the culprit...

Patrice

--

"Marius Horak" <so*****@europe.eu> a écrit dans le message de
news:eu**************@TK2MSFTNGP12.phx.gbl...

Web application has the following code for downloading a file from a server
this.Context.Response.Clear();
this.Context.Response.BufferOutput = false;
this.Context.Response.ContentType = "application/octet-stream";
this.Context.Response.AddHeader("Content-Disposition","attachment;
filename=" + FileName);
// this.Context.Response.AddHeader("Content-Length",fileSize.ToString());
this.Context.Response.Flush();
this.Context.Response.WriteFile(FullFileName);
// this.Context.Response.Flush();
// this.Context.Response.End();

It runs after a button on a page is clicked.
The code apparently never worked. Code is being executed without errors but nothing happens.
I checked some examples and they were more or less as the above code.
What could be wrong?
What should I expect with working code - the download dialog box?

Thanks

MH

Jul 21 '05 #2

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

Similar topics

5
by: peetm | last post by:
I'd like to write to a log whenever a visitor to my site downloads a file. So, I'd like the link they click to be to a php 'page' that returns the file. Don't know how to do that! Side...
5
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily...
0
by: Movie Maniac? | last post by:
Hi everybody I'm writing a module for postnuke and MD-Pro to manage a subtitles section, and I'm experiencing some troubles with the download function. It works properly if I click directly...
1
by: Dave | last post by:
Hi Everyone, I was wondering if anyone has ever successfully used SA-FileUp's download feature. I am being forced to change from "ASPSmartUpload" as the server I am moving everything to is...
15
by: Frances Del Rio | last post by:
I have a bunch of Photoshop images on my server, I want when user clicks on a link to a Photoshop img for it to start downloading (like when you click on a Word file..) how can I do that? thank...
0
by: totalgeekdom | last post by:
I currently have a cgi-bin which I use to authenticate users against a SQL database, which holds info about them, and their login info. I would like to have the 'admin' section take part of the...
0
by: Buddy Ackerman | last post by:
I am trying to implment a file download via a link such that when clicked, instead of starting the default application for that type of file the user will be presented with a download dialog...
7
by: Brian Paul | last post by:
When a user clicks on a linkbutton on a page, i would like to render a printer-friendly version of the asp.net page and download it as an html attachment to the browser. The code below works great,...
1
by: George Homorozeanu | last post by:
We create an excel object with Excel/Office Interop Assembly and we want to offer this excel object as download without creating physically the file. The download window appears with "Save As.",...
2
by: thisis | last post by:
Hi All, I need the PUBS.mdb for pulling images: PUBS.mdb must have the table: pub_info tbl_pub_info : has 3 fields Data_Type : ok Data_Type : ok
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.