N
Nathan Sokalski
I have an application in which I want to allow users to view certain files
that are on the server, but not part of the application. To do this, I
figured I would have ASP.NET read the files and send them to Response. I
have done this with images by reading them into a Bitmap object and then
using the following code:
Response.ClearContent()
Response.ContentType = "image/gif"
mybitmap.Save(Response.OutputStream, ImageFormat.Gif)
I will obviously need to use the Response.ClearContent() and
Response.ContentType lines, but because the files are not necessarily
images, I need to know how to send them to Response. I would have though
that
Response.WriteFile(filepath)
OR
Response.TransmitFile(filepath)
would work, but apparently they didn't. The basic idea is just reading and
writing a file, except the "writing" is more of a sending than a writing. I
know how to allow people to download a file (using the "content-disposition"
header), but what I want to do here is basically use a file in my site, but
not put the file in my site directory. Any ideas? Thanks.
that are on the server, but not part of the application. To do this, I
figured I would have ASP.NET read the files and send them to Response. I
have done this with images by reading them into a Bitmap object and then
using the following code:
Response.ClearContent()
Response.ContentType = "image/gif"
mybitmap.Save(Response.OutputStream, ImageFormat.Gif)
I will obviously need to use the Response.ClearContent() and
Response.ContentType lines, but because the files are not necessarily
images, I need to know how to send them to Response. I would have though
that
Response.WriteFile(filepath)
OR
Response.TransmitFile(filepath)
would work, but apparently they didn't. The basic idea is just reading and
writing a file, except the "writing" is more of a sending than a writing. I
know how to allow people to download a file (using the "content-disposition"
header), but what I want to do here is basically use a file in my site, but
not put the file in my site directory. Any ideas? Thanks.