Double counting document downloads
<httpHandlers>
<add verb="*" path="*.pdf" type="DocumentHandler"/>
<add verb="*" path="*.doc" type="DocumentHandler"/>
<add verb="*" path="*.docx" type="DocumentHandler"/>
</httpHandlers>DocumentHandler has a ProcessRequest method. Within this method we increment our count.When opening a .pdf by either Firefox or IE this method gets called once.
When opening a .doc or .docx with Firefox this method gets called once.
When opening a .doc or .docx with IE this method gets called twice. Firstly when the browser window is created, and then when the Open dialog is displayed.I spent some time looking into this, especially concentrating on the differences within the context.Request object. The second time this method is hit, the UserAgent is Microsoft Office Existence Discovery. The other, more usable, difference is that Context.Request.UrlReferrer is null. This is the condition I have chosen to use to prevent the double counting. If someone stores the link to the document as a bookmark, then this won't count, but within the context of this application this is unlikely.