Without using MVC you can use something called IHttpHandler
This will allow you to process the request for the URL in any way convenient for you. You will add the code to your web.config, for example:
<httpHandlers> <add verb="*" path="/documents/*.pdf" type="Documents.LoadDocument,NameSpace"/> </httpHandlers>
Then you will have the Namespace.Documents.LoadDocument class. This implements the IHttpHandler interface (there are only two methods, and one of them is just a bool that indicates whether your object is thread safe)
There is information here that describes how to serve dynamic content using IHttpHandler.
I believe that this is exactly what you are looking for. You can download a document from the database based on the actual HTTP request.
source share