473,378 Members | 1,544 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,378 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 1418
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.