Monthly archives: July, 2014

Block access to images from other websites

In ASP.NET you can write HTTP Modules to perform actions inside the request pipeline before the request is being finally processed. In this example we use an HTTP Module to check whether the REFERER header matches our website. If it doesn’t then we won’t allow access to the resources. By doing this we can simply




Mocking async repository calls

Mocking is a great technique for isolating code that you want to test. By mocking the interfaces a code section depends on you can create an isolation level where only the behavior of this specific code section is being tested. In my example I have a ProfileService (BLL) that takes an IProfileRepository interface (DAL) as




Running a background thread inside an ASP.NET website

When most people think of a web site or web application they think of something that respond to user navigations. The site has a life cycle that begins when the call comes in and ends when the response has been returned. Between these users calls the site is dead. But in reality it’s possible to




%d bloggers like this: