My Short URL
When we get down to programming techniques, I have tried most of them out at some time or another , that is with regards to the .Net framework. Alas the one thing I have been trying to find a use for is http handlers.
Handlers are an integral part of the ASP.net framework , but also one of the more tricky things to use since they have no general outstanding features. They allow you to write general system wide modules , so for the average person that has worked with .Net, the use of handlers is not very apparent.
Not to long ago I came across a small problem at work that was solved very nicely using an http handler and I thought I should share this. The general problem was the following: like every other business out there, we have to interface with many other systems that are not controlled by us and as such there are many changes that need to be made workable using workarounds. The particular problem revolved around the specified field being used to store an internal URL (so that it can be used at a later stage ) being too short and since they would not change the column size we were left with a system that could not function.
So I proposed the following solution to the team; create a local in-house shrinker. Due to security reasons we could not leave our URLs on an external server , so the thought of using a shrinker or any of the likes was out of the question. So all that we did was create a single fully indexed table to store the original URL and return the ID to the user as part of a clean URL using the handler.
The beauty of this setup is that it can be implemented without affecting the users. A very good example of this is ELMAH. It is by far one of the coolest implementations of http handlers. It’s able to intercept any errors that occur in your web app and handle them as defined in your web.config .
Just remember there is aways more than one way to do something in .Net ;) .
~stalkerh

