Tag: csharp

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




%d bloggers like this: