Re: streaming random filetypes from .aspx

From: Keith Patrick (richard_keith_patrick_at_hotmail.com)
Date: 10/20/05

  • Next message: Richard Grimes: "Re: Security for remote EventLog access?"
    Date: Thu, 20 Oct 2005 15:13:43 -0500
    
    

    AFAIK, IE considers a streamed file to be an automatic download and thus
    requires that the Download bar appears at the top of the browser. Do stream
    a file this way, you basically do this:
    this.Response.Clear();
    this.Response.ContentType = "<whatever the MIME type is>";
    this.Response.AddHeader("Content-Disposition",
    "attachment;filename=myfile.txt");
    this.Response.Write(...);
    this.Response.Flush()

    And of course, wrap all that up in a try/catch so you can clean up when
    done.

    To do what you are asking (link to a file), you'd need to create the file
    locally & drop it in a directory visible to the limited ASP user, and create
    the link. Problem with this is setting the lifetime of the file, as it
    should be a temp file, but it's hard to know when the file is no longer
    deleted (session ends aren't something you can count on being notified of,
    as it doesn't happen in a cluster)


  • Next message: Richard Grimes: "Re: Security for remote EventLog access?"