Not picking on you
CrimsonDiva, but people seem to continually misunderstand the most
basic realities of web development. Maybe it seems that way because everyone asks these questions only once, but since
everyone asks the same question over and over again the rest of us start pulling out our hair.
You need to step back a minute and realize that the web was designed to let you enter a page's address and pull back a "web document" to view. These documents can have links that you can click on, saving you the trouble of manually entering URLs to request additional documents.
Forms were added soon after, but they follow the same model. Submitting a form is really just requesting another document, along with some parameters as well as the address of that document.
CGI, ASP, and other "active web" technologies rely on a server being able to tell when a request isn't for a static document. The web server then passes the request to a program or a scripted page or something. This "active web" logic is supposed to process the request and build up a web document (page) to be returned to the browser.
That's about it really.
Think of it this way: it is sort of like very fast email. You (via your browser) send a brief email to the server. The server gets this, figures out what you want, and emails it back to you (at your browser) where you can view it.
So clearly you can't "run code" over email. And you can't run code over HTTP either.
What you CAN do is make requests via HTTP and get back results.
Problem is, downloading a PDF is usually the same as downloading static HTML, or a JPEG, or about anything else. The server handles this as part of its static document processing. Your ASP code never SEES the request.
Instead you need to have the link the user clicks on go to an ASP page. This ASP page would do your logging and stream the PDF back to the user. So now you need to do the work that the server normally does for you.
Here's a simple example returning an Excel document:
I assume you can't just extract what you need from the IIS logs for some reason?