O
Oleg Ogurok
Hi all,
I'm trying to create an ASPX page that will output itself as a text file.
For instance, if I have a file text.txt and I try to fetch it through
telnet, I get something like this
INPUT:
OUTPUT: the contents of text.txt as is.
The problem is that I need to generate the text file on the fly via C#.
However, if I try it (in aspx.cs), the page is always prepended with headers
that look like the following:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 15 Mar 2004 17:22:15 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/html; charset=utf-8
Then the text follows.
Is there a way to make the page not output the headers?
Here's the code I'm using (doesn't work) in Page_Load():
Response.ContentType = "text/plain";
Response.Clear();
Response.ClearHeaders();
Response.Write("Text file starts here\r\nYep");
Response.End();
Thanks.
I'm trying to create an ASPX page that will output itself as a text file.
For instance, if I have a file text.txt and I try to fetch it through
telnet, I get something like this
INPUT:
GET /text.txttelnet localhost 80
OUTPUT: the contents of text.txt as is.
The problem is that I need to generate the text file on the fly via C#.
However, if I try it (in aspx.cs), the page is always prepended with headers
that look like the following:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 15 Mar 2004 17:22:15 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/html; charset=utf-8
Then the text follows.
Is there a way to make the page not output the headers?
Here's the code I'm using (doesn't work) in Page_Load():
Response.ContentType = "text/plain";
Response.Clear();
Response.ClearHeaders();
Response.Write("Text file starts here\r\nYep");
Response.End();
Thanks.