Given the low amount of information in your question, I can only answer concisely.
- When the user triggers the migration (i.e. sends the request to MVC), you'll have to trigger the migration in a different thread.
- Make sure that the different thread has access to a globally accessible variable, e.g.
bool MigrationIsRunning
. Your migration will set this totrue
when starting, and back tofalse
when completed (by success, or by error. Either way). - When your user returns to the migration page, have your Controller method check the value of
MigrationIsRunning
(the variable from the previous step), and return the correct feedback to the user.
Note: instead of a bool, you could use a custom class that shows more detail. I'm not sure what your users need to know when the migration's running.
Note 2: If your entire application should be inaccessible during the migration, you're better off with placing step 3 either in your Masterpage, or Global.asax, so you have full coverage of your web application instead of a single page.