I am using forms authentication on an application that needs to secure Microsoft Word and Excel files. I set up the .doc and .xls in the app mappings section of my Web Application in iis. This works correctly when I login for the first time going to any given
page. However, after I have went to a secured page, if the page is stored in my Temporay Internet Files it will not require me to log in again. How do I keep this from happening? I want it to time out like the .aspx files do after 10 minutes or when the browser
is closed. Thanks, Brian Nicoloff
Brian, You will need to write an HttpHandler and map it to the extensions you would like to download. This handler will be used to process every request to these files, and you can subsequently inspect the request url, identify the file requested, and then
write it directly to the response with some headers that will trigger a download in the client browser. You would also include some cache control headers to prevent the files from staying in the browser cache. Here is a google groups thread that I've found
that explains what headers you need to trigger a download in the browser (check out the bottom of the thread to make sure you get the modification to initial code): http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=Wc1r8.119110%24%25g7.3792886%40twister2.libero.it&rnum=6&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dasp.net%2Bdownload%2Bcode
You will also need to include some cache control headers to make sure the file isnt cached:
nicolobj
Member
25 Points
5 Posts
App Mappinings for .doc and .xls files
Sep 15, 2003 07:02 PM|LINK
mvolo
Contributor
2202 Points
441 Posts
MVP
Re: App Mappinings for .doc and .xls files
Oct 06, 2003 06:35 AM|LINK
Context.Response.AppendHeader("Pragma", "No-cache"); Context.AppendHeader("Cache-Control", "no-cache"); Context.AppendHeader("Expires", DateTime.Now.ToString());Here is a post that goes over creating your own HttpHandler: http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=353955 Hope this helps,CTO at LeanSentry
Former IIS/ASP.NET PM
Want to become an expert at monitoring and troubleshooting your IIS applications?
See the demo at www.leansentry.com!