Setting up an online ad serving platform

I’m thinking about building my own online ad serving platform that would serve Flash ads as well as track impressions, click-throughs and user interactions. Does anyone know the best way to do this? PHP? .NET?

Where would I start? Any advice would be greatly appreciated.

Thanks.