473,624 Members | 2,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outputing text file to response stream

Hi all

I have the contents of a text file that I would like to output to the
response stream, however IE thinks it is XML and comes up with and error,
here is the code:

Response.Conten tType = "test/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);

Response.End();
Any ideas?
Thanks
KEv
Nov 19 '05 #1
8 2763
corrected:
Hi all

I have the contents of a text file that I would like to output to the
response stream, however IE thinks it is XML and comes up with and error,
here is the code:

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);

Response.End();
Any ideas?
Thanks
KEv

Nov 19 '05 #2
That doesn't mean I've sorted it lol, just correcting the post...
"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
corrected:
Hi all

I have the contents of a text file that I would like to output to the
response stream, however IE thinks it is XML and comes up with and error,
here is the code:

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);

Response.End();
Any ideas?
Thanks
KEv


Nov 19 '05 #3
Quick guess - shouldn't this read

Response.Conten tType = "text/plain";

and not

Response.Conten tType = "test/plain";

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
Hi all

I have the contents of a text file that I would like to output to the
response stream, however IE thinks it is XML and comes up with and error,
here is the code:

Response.Conten tType = "test/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);

Response.End();
Any ideas?
Thanks
KEv

Nov 19 '05 #4
See my 2nd message.

Kev

"John Timney (ASP.NET MVP)" <ti*****@despam med.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Quick guess - shouldn't this read

Response.Conten tType = "text/plain";

and not

Response.Conten tType = "test/plain";

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
Hi all

I have the contents of a text file that I would like to output to the
response stream, however IE thinks it is XML and comes up with and error,
here is the code:

Response.Conten tType = "test/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);

Response.End();
Any ideas?
Thanks
KEv


Nov 19 '05 #5
try adding a filename header

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);
Response.AddHea der "Content-Disposition", "inline;filenam e=temp.txt"

or change your content type to text/html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
That doesn't mean I've sorted it lol, just correcting the post...
"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
corrected:
Hi all

I have the contents of a text file that I would like to output to the
response stream, however IE thinks it is XML and comes up with and
error, here is the code:

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);

Response.End();
Any ideas?
Thanks
KEv



Nov 19 '05 #6
Excellent, I added the filename header and that worked. What is the
filename actually used for?

Thanks
Kev

"John Timney (ASP.NET MVP)" <ti*****@despam med.com> wrote in message
news:OP******** ******@tk2msftn gp13.phx.gbl...
try adding a filename header

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);
Response.AddHea der "Content-Disposition", "inline;filenam e=temp.txt"

or change your content type to text/html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
That doesn't mean I've sorted it lol, just correcting the post...
"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
corrected:

Hi all

I have the contents of a text file that I would like to output to the
response stream, however IE thinks it is XML and comes up with and
error, here is the code:

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);

Response.End();
Any ideas?
Thanks
KEv



Nov 19 '05 #7
Most browsers have no understanding of what text/plain actually is - so it
interprets the stream as something else. The filename simply tells it that
its a .txt file extension and the system should treat it accordingly.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
Excellent, I added the filename header and that worked. What is the
filename actually used for?

Thanks
Kev

"John Timney (ASP.NET MVP)" <ti*****@despam med.com> wrote in message
news:OP******** ******@tk2msftn gp13.phx.gbl...
try adding a filename header

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);
Response.AddHea der "Content-Disposition", "inline;filenam e=temp.txt"

or change your content type to text/html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
That doesn't mean I've sorted it lol, just correcting the post...
"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
corrected:

> Hi all
>
> I have the contents of a text file that I would like to output to the
> response stream, however IE thinks it is XML and comes up with and
> error, here is the code:
>
> Response.Conten tType = "text/plain";
> Response.Output Stream.Write(bu ffer, 0, buffer.Length);
>
> Response.End();
>
>
> Any ideas?
> Thanks
> KEv
>



Nov 19 '05 #8
Thanks for your help John.

Kev

"John Timney (ASP.NET MVP)" <ti*****@despam med.com> wrote in message
news:Oi******** *****@TK2MSFTNG P14.phx.gbl...
Most browsers have no understanding of what text/plain actually is - so it
interprets the stream as something else. The filename simply tells it
that its a .txt file extension and the system should treat it accordingly.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
Excellent, I added the filename header and that worked. What is the
filename actually used for?

Thanks
Kev

"John Timney (ASP.NET MVP)" <ti*****@despam med.com> wrote in message
news:OP******** ******@tk2msftn gp13.phx.gbl...
try adding a filename header

Response.Conten tType = "text/plain";
Response.Output Stream.Write(bu ffer, 0, buffer.Length);
Response.AddHea der "Content-Disposition", "inline;filenam e=temp.txt"

or change your content type to text/html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
That doesn't mean I've sorted it lol, just correcting the post...
"Mantorok" <no**@tiscali.c o.uk> wrote in message
news:de******** **@newsfeed.th. ifl.net...
> corrected:
>
>> Hi all
>>
>> I have the contents of a text file that I would like to output to the
>> response stream, however IE thinks it is XML and comes up with and
>> error, here is the code:
>>
>> Response.Conten tType = "text/plain";
>> Response.Output Stream.Write(bu ffer, 0, buffer.Length);
>>
>> Response.End();
>>
>>
>> Any ideas?
>> Thanks
>> KEv
>>
>
>



Nov 19 '05 #9

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

Similar topics

4
11512
by: H Lee | last post by:
Hi, I'm an XML newbie, and not sure if this is the appropriate newsgroup to post my question, so feel free to suggest other newgroups where I should post this message if this is the case. I'm having issues using XmlTextWriter, saving it out to a file with UTF8 encoding, and seeing "dirty", or "human unreadable" characters show up *right before* the XML declaration. I need to have the XML declaration state "encoding = utf-8", but also...
2
3385
by: Jeff G. | last post by:
Hello everyone, I have read through the newsgroups (thank God for 'em!) extensively looking for an example of how to pass a file (PDF) from a webresponse stream down to a web client. Here's the scenario - when the web browser requests a file, the IIS Server1 has to go back to Server2 to make a request for the file. Server2 then responds the file back to Server1 and Server1 should be able to just forward the file down to the web browser....
3
2625
by: Peter | last post by:
Hello! Please, could you tell me, is it possible to create and stream for example a text file to the browser so that the file is not stored anywhere on a hard drive? User click's a link, eg. http://my.domain.com/apps/app/page.aspx?docID=235 and then the text file opens with a text "235" and when the user closes the file there is not track of the file anywhere on a hard drive.
1
5375
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved completely/succsessfully on the client's computer before updating some metadata on the server (file downloaded date for instance) However, All examples i have tried, and all examples I have found that other people says works - doesn't work for me :-(
10
8044
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
3
1577
by: premier | last post by:
I have a web page that's taking in data from text boxes, drawing a chart to represent the data, and then outputting the chart in PNG format. What I cant figure out how to do, is to output the chart as part of an aspx web page. Ideally, I'd output it to the bottom of the web page that the user used to send the data to the server. Or, I could output the PNG as part of a new Web page. I'm just lost on the details. I'm currently...
0
1569
by: Sid | last post by:
i am inplementing an intranet using asp 3.0 with vbscript. i want to know how to make my webserver download a file on the client.the file is grater than 60 mb. i have a script which does not download a file greater than 4mb. Dim Stream Dim Contents Dim FileName Dim FileExt Const adTypeBinary = 1 FileName = Rec("file_path")
5
2066
by: Simon Rigby | last post by:
Hi folks, Apologies if this is not directly relevant but I was struggling to find a group with the appropriate context. So as my problem is in an aspx web site I thought I'd try here first. Please feel free to suggest a more relevent group. I have some code that I am using to build a stream (test text at this stage, although eventually will come from a database query). I want to have this available as a download without having to...
5
3934
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, The following code was suggested by one of the users in this newsgroup when a pdf file was requested by a user from an asp page. I used the similar code in my page and the very interesting thing is when the pdf is displayed on the fly, the whole page is a gibberish code in stead of a normal pdf file. But it displays fine if I just use a link to a file on the page. Can you tell me what's the possible reason will cause this problem?...
0
8231
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8168
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8672
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8614
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7153
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6107
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2603
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 we have to send another system
2
1474
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.