You you need read about Generic handlers. When you implement a generic handlers that means you're telling the ASP.NET engine to act in a certain way and do a certain thing whenever your application comes across a request of a generic type (image, querystring...). That is one way that I know of to automate the reading and inserting the querystring into the ur database.
Hope this helps mate!
P.S. should you need the book (Pro ASP.NET 3.5 in C# 3.0) mail me up at [email]firstname.lastname@example.org[/email] and i'll send it to you in PDF.