473,499 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Download text file


Hi

I want to offer people to actually download text file and not view it on
browser (which is what happens by default)

Thank you,
Samuel
Jun 14 '07 #1
3 1228
You can force the download control by using :
http://support.microsoft.com/kb/260519/en-us
(applies as well to ASP.NET)

Once thr header is written you can then use Response.WriteFile to stream the
file to the browser...

--
Patrice

"Samuel" <sa************@ntlworld.coma écrit dans le message de news:
uk**************@TK2MSFTNGP04.phx.gbl...
>
Hi

I want to offer people to actually download text file and not view it on
browser (which is what happens by default)

Thank you,
Samuel

Jun 14 '07 #2
I added the following code:

Response.AddHeader("content-disposition", "attachment;
filename=FileName.txt")

Response.ClearContent()

Response.WriteFile("FileName.txt")

But I get mcuh more content than the text file

Thank you,
Samuel

"Patrice" <http://www.chez.com/scribe/wrote in message
news:u5*************@TK2MSFTNGP02.phx.gbl...
You can force the download control by using :
http://support.microsoft.com/kb/260519/en-us
(applies as well to ASP.NET)

Once thr header is written you can then use Response.WriteFile to stream
the file to the browser...

--
Patrice

"Samuel" <sa************@ntlworld.coma écrit dans le message de news:
uk**************@TK2MSFTNGP04.phx.gbl...
>>
Hi

I want to offer people to actually download text file and not view it on
browser (which is what happens by default)

Thank you,
Samuel


Jun 15 '07 #3
That is ? Make sure also to clear the markup etc.. Basically such a page
should return anything but your content (i.. you shouldn't return any HTML,
html code, master pages content etc...). Though it's likely better to clean
up these elements for clarity a quick way to check this would to use
Response.end to end the streaming once the file is trnasmitted.

If the content is no more there this is because your page renders other
things at a later time (such as HTML markup if you have still this in your
ASPX page).

--
Patrice

"Samuel" <sa************@ntlworld.coma écrit dans le message de news:
O3*************@TK2MSFTNGP06.phx.gbl...
>I added the following code:

Response.AddHeader("content-disposition", "attachment;
filename=FileName.txt")

Response.ClearContent()

Response.WriteFile("FileName.txt")

But I get mcuh more content than the text file

Thank you,
Samuel

"Patrice" <http://www.chez.com/scribe/wrote in message
news:u5*************@TK2MSFTNGP02.phx.gbl...
>You can force the download control by using :
http://support.microsoft.com/kb/260519/en-us
(applies as well to ASP.NET)

Once thr header is written you can then use Response.WriteFile to stream
the file to the browser...

--
Patrice

"Samuel" <sa************@ntlworld.coma écrit dans le message de news:
uk**************@TK2MSFTNGP04.phx.gbl...
>>>
Hi

I want to offer people to actually download text file and not view it on
browser (which is what happens by default)

Thank you,
Samuel



Jun 15 '07 #4

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

Similar topics

5
5811
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
6078
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...
2
1982
by: Tom Youngquist | last post by:
I am trying to download a text file that my .NET page has just created based on entered parameters on the web page. Everything seems to work and the file is created. I am using the following code...
0
2559
by: jmd | last post by:
Hello. I want to write a C# program that does completely automatically what, until now, I do manually, witch is describe below : 1. I launch IE (6) 2. I browse to my desired download page, say...
0
1724
by: Rhys666 | last post by:
Basically I have a link that opens my download page and the querystring identifies the type of 'template' Excel spreadsheet has asked to download. The download page reads the querystring,...
4
2311
by: Nathan Sokalski | last post by:
I want to give visitors to my site the option of downloading a generated ..txt file by clicking a button. I know how to generate text files, but how do I cause the browser to pop up one of those...
18
16363
by: jmd | last post by:
Hello, I posted the following in the C# forum but without one answer. But perhaps now in vb.net someone has some guidelines ! This is my question : I want to write a vb.net program that does...
3
2119
by: tshad | last post by:
I have a function that downloads a file to the users computer and it works fine. The problem is that I then want the program to rename the file (file.move) to the same name plus todays date. ...
16
3218
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
1
47344
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
7014
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
7180
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,...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4609
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...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
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 ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
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...

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.