text/plain ContentType

G

George Durzi

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?
 
G

George Durzi

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top