I'm new to C#, so please bear with me.
I have a function that runs in the
Its in general not a good idea to put a lot of code in Application_End that you need to rely on firing. Consider that an ApplicationInstance is started to each thread of the work process that will be serving your application, you will run into scenarios where your Application_End will be called frequently on a busy site as traffic ebbs and flows.
You may find it easier to use a Cache object with a sliding expiration and a callback function when the object expires from Cache to ensure that your clean up code is called properly when you need it.