I am not an ASP.Net developer. But I do this sort of thing in my windows applications via a module. Can't see how it would work any different in ASP.Net