Question

I have asp.net Mvc application in which I am migrating mails from one exchange server to another , now I want to keep running migration process and don't want to keep open browser means when user closes browser process must be running at the back and after opening the browser user can check the progress of migration. Can anyone help me in this, how to achieve this task using asp.net Mvc 4 c# or using any other service

Was it helpful?

Solution

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 to true when starting, and back to false 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top