473,399 Members | 3,038 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,399 software developers and data experts.

text/plain ContentType

I'm writing an ASPX page to open a .txt file, and display it in the browser.
Here's what I'm doing:

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "text/plain"
Response.WriteFile(sExportPath)
Response.Flush()
Response.Close()

What happens is that I did an open/save dialog.

If I choose Save, it wants to save the file as MyASPXPageName.aspx
and if I choose open, it opens the .aspx file which contains text.

Anyway that I can actually get this to open in the browser?
Nov 18 '05 #1
2 1623
May be your IIS is writing out a header for caching.

Sekhar.
"George Durzi" <gd****@hotmail.com> wrote in message
news:uY*************@TK2MSFTNGP09.phx.gbl...
I'm writing an ASPX page to open a .txt file, and display it in the browser. Here's what I'm doing:

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "text/plain"
Response.WriteFile(sExportPath)
Response.Flush()
Response.Close()

What happens is that I did an open/save dialog.

If I choose Save, it wants to save the file as MyASPXPageName.aspx
and if I choose open, it opens the .aspx file which contains text.

Anyway that I can actually get this to open in the browser?

Nov 18 '05 #2
My page is building the response, and unless I add something manually to the
header, such as

Response.AddHeader "content-disposition", "attachment; filename=""" &
fileName & """"

the file should open automatically in the browser. It works fine for PDF
files...

"Chandra Sekhar" <Ch*************@am.joneslanglasalle.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
May be your IIS is writing out a header for caching.

Sekhar.
"George Durzi" <gd****@hotmail.com> wrote in message
news:uY*************@TK2MSFTNGP09.phx.gbl...
I'm writing an ASPX page to open a .txt file, and display it in the

browser.
Here's what I'm doing:

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "text/plain"
Response.WriteFile(sExportPath)
Response.Flush()
Response.Close()

What happens is that I did an open/save dialog.

If I choose Save, it wants to save the file as MyASPXPageName.aspx
and if I choose open, it opens the .aspx file which contains text.

Anyway that I can actually get this to open in the browser?


Nov 18 '05 #3

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

Similar topics

2
by: Mike Bridge | last post by:
Is there any way to get Internet explorer to treat a text/plain .net page as plain text using asp.net? It seems like IE doesn't trust text/plain as a mime type, and so it (ironically) displays it...
7
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a...
3
by: MarkMurphy | last post by:
I have a simple export.aspx page that allows a user to fill in a form to export some data. The postback logic writes the data to the response stream. I have two small issues: 1) The data is...
5
by: David Thielen | last post by:
Hi; I am writing the output of a page directly using IHttpHandler, IRequireSessionState and if it is a text file I set HttpContext.Response.ContentType = "text/plain". But when it displays I get...
3
by: letuce dance | last post by:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender,...
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: 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...
0
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.