locked
Redirect HttpResponse to file as well as output stream? RRS feed

  • Question

  • User-1014994263 posted
    Is it possible to split all the the http response stream to a text file on the server? I have it kindof working right now by setting the Response.Filter an object that derives from Stream and writes to a text file on its Write method, but that only catches the output generated by Response.Write. I want to catch it all to a file. What I'm really trying to do: Have a web form which the user fills a bunch of fields. They hit a button to post the page. The server generates an html file, writes the file to disk, and then displays this file to the user. But I don't want to a ton of 'outputfile.Write()' calls to write the html code to the output file. I'd like to just catch the output stream thats sent to the user's browser and write it to a file. Make sense? Am I thinking about this the wrong way? Thanks.
    Friday, May 28, 2004 8:42 PM

All replies

  • User-1014994263 posted
    Any ideas on this? What I'm thinking of doing now is using a HttpWebRequest to pull another .aspx page in order to generate the HTML, passing it a serialized object with the data I want in the form, and then saving the HTML returned in the request to a file. Or is there an easier way of doing this? Anyone?
    Tuesday, June 1, 2004 10:37 AM
  • User-1449169821 posted
    Use an HttpModule - (e.g., http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomhttpmodules.asp), the Response object avaialble from EndRequest should give you access to the stream.
    Thursday, June 3, 2004 11:00 AM