Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Re: Download a text file


Message #1 by "ALTA" <altaf.ahmed@l...> on Wed, 28 Aug 2002 07:41:42
hi,
 This is Altaf,
You can download a text file from the browser.by changing the header 
settings.
in case of ASP 
use response.headers on the top of the page.
use this code below....

-------------------------------------------------------------------------
<%Response.buffer = TRUE%>
<%Response.AddHeader "content-disposition","attachment;filename=file.txt"%>
<%Response.ContentType = "application/NOTEPAD"%>
-------------------------------------------------------------------------



> Can anyone please tell me how to download a text file? I can create it 
using 
> the file system object but then I need to get it to the client.
> 
> Any help is appreciated.
> Chuck
> 
Message #2 by "Hugh McLaughlin" <hugh@k...> on Wed, 28 Aug 2002 22:19:49
Hi Altaf,

What exactly are you trying to accomplish?  Is it to force the download 
manager open?  If this is the case then use:

Response.ContentType="text/octet-stream"

Let me know if this is what you are trying to do.

Hugh


\\hi,
 > Th, thenAltaf,
Y> ou can download a text file from the browser.by changing the header 
s> ettings.
i> n case of ASP 
u> se response.headers on the top of the page.
u> se this code below....

> ------------------------------------------------------------------------
-
<> %Response.buffer = TRUE%>
<> %Response.AddHeader "content-
disposition","attachment;filename=file.txt"%>
<> %Response.ContentType = "application/NOTEPAD"%>
-> -----------------------------------------------------------------------
-

> 

> > Can anyone please tell me how to download a text file? I can create 
it 
u> sing 
>>  the file system object but then I need to get it to the client.
>>  
>>  Any help is appreciated.
>>  Chuck
>>  
Message #3 by altaf ahmed <altaf.ahmed@l...> on Thu, 29 Aug 2002 09:52:58 +0530
Hi hugh,

It allows the Forced Download type property when a page is visited.
 It works great for creating text files on the fly then sending them to the
client

bye 
Altaf
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Thursday, August 29, 2002 3:50 AM
To: ASP+
Subject: [aspx] Re: Download a text file


Hi Altaf,

What exactly are you trying to accomplish?  Is it to force the download 
manager open?  If this is the case then use:

Response.ContentType="text/octet-stream"

Let me know if this is what you are trying to do.

Hugh


\\hi,
 > Th, thenAltaf,
Y> ou can download a text file from the browser.by changing the header 
s> ettings.
i> n case of ASP 
u> se response.headers on the top of the page.
u> se this code below....

> ------------------------------------------------------------------------
-
<> %Response.buffer = TRUE%>
<> %Response.AddHeader "content-
disposition","attachment;filename=file.txt"%>
<> %Response.ContentType = "application/NOTEPAD"%>
-> -----------------------------------------------------------------------
-

> 

> > Can anyone please tell me how to download a text file? I can create 
it 
u> sing 
>>  the file system object but then I need to get it to the client.
>>  
>>  Any help is appreciated.
>>  Chuck
>>  
---

ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442

ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450

These books are a complete reference to the ASP.NET namespaces 
for developers who are already familiar with using ASP.NET. 
There is no trivial introductory material or useless .NET 
hype and the presentation of the namespaces, in an easy-to use 
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes, 
giving you those real-world tips that the documentation doesn't 
offer, and demonstrating complex techniques with simple 
examples.  

---

  Return to Index