text/plain ContentType

  • Thread starter Thread starter George Durzi
  • Start date Start date
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?
 
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...
 
Back
Top