String strRequest = Request.QueryString //- if something was passed to the file querystring if ( strRequest != "" ) void Page_Load ( object sender, EventArgs e ) Now, in downloadfile.aspx, you need to set up things like this example (though you SHOULD check to ensure they are downloading from the directory you expect!): Let's say they send the request to your page like this: (Excel's is "application/vnd.ms-excel" I believe) did not seem to help, but I am running the beta for Office 2007, so that might be a security feature to not display them within the browser and it still closed the window. Providing the mime type for the Office types One case did not close the window, which was a PDF file using "application/octet-stream" but by providing "application/pdf" it was correctly opened in the window. I am running IE 7. Testing on my own machine with various file types, it opened up the new window and either loaded the file in the window (text, HTML), or required me to open it with the Download dialog, which closed the window when I downloaded You should also send the proper mime type (text/html for HTML documents, for instance), but it is not always necessary and application/octet-stream basically Remove the "attachment " portion of the "Content-Disposition" header and it should work.
0 Comments
Leave a Reply. |