Q:

Doing some clean-up after client request fully served, in c# ASP.net MVC, how?

lets assume I have an action like:
    public ActionResult Register()
    {
        // Doing user register
        user_register();   // take almost no time
        // doing some stats and other clean up
        more_clean_up();   // take few seconds
        return View();
    }

here is what I want to achieve:
        user_register();
        return View();
        more_clean_up();

I know above code won't work, more_clean_up(); will never be executed. 
Since more_clean_up(); task is not important for the view(), also it take time, so I want to it execute some way not block current users view experience.
I know a way to open another thread or go async, but I more prefer if here is a way to:
doing_some_render_for_client();
Response.Flush();
**disconnect_from_client();**
more_clean_up();

Does anyone know how to disconnect_from_client(); but not terminate like ApplicationInstance.CompleteRequest(); does
Thanks.

A:

You should look into spawning a new thread for this using ThreadPool. Simply give it your more_clean_up method (you'll have to make sure it has single object parameter)  and you should be all set.
To answer your second question more specifically - No, you really shouldn't be trying to do that.

