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?May be your IIS is writing out a header for caching.
Sekhar.
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:uYb$u1JfEHA.712@.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?
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" <Chandra.Shekhar@.am.joneslanglasalle.com> wrote in message
news:e23snIKfEHA.2848@.TK2MSFTNGP10.phx.gbl...
> May be your IIS is writing out a header for caching.
> Sekhar.
>
> "George Durzi" <gdurzi@.hotmail.com> wrote in message
> news:uYb$u1JfEHA.712@.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?
0 comments:
Post a Comment