SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got the following code below , it starts a long running process , once the processing completes it will redirects to another page using EndScript().However,SPLongProcess never redirects to the destination page and hanging on the processing page forever.But the actual processing is complete.All the data is saved , web service is called , error is handled. Can someone shine some light on this?

private void HandleSubmitClicked()
        SPWeb web = SPContext.Current.Web;
        SPListItem currentItem = SPContext.Current.ListItem;
        var applicationRepository = new ApplicationRepository(web, new DocumentSetGenerator(web));
        var application = ApplicationBuilder.Build(currentItem);
        using (SPLongOperation longOperation = new SPLongOperation(Page))
            longOperation.LeadingHTML = "Submitting to Orca";
            longOperation.TrailingHTML = "Please wait while the application is being processed.";
                string newLocation = new SubmitToOrcaController(new ApplicationProcessorFactory(web).ApplicationProcessor(), applicationRepository).Submit(application);
                string libraryLocation = string.Format("{0}/{1}", web.Url, ApplicationLibraryNamesConstant.ApplicationLibraryName);
                string endScript = string.Format("window.location = \"{0}\";", newLocation);
                if (newLocation.Equals(libraryLocation, StringComparison.InvariantCultureIgnoreCase))
                    endScript = string.Format("window.location = \"{0}?queuename={1}\";", newLocation,application.Queue);
            catch (ThreadAbortException)
                //The explanation for how the exception is handled is from the blog post below.
                // Don’t do anything, this error can occur because the SPLongOperation.End
                // performs a Response.Redirect internally and doesnt take into account
                // that other code might still be executed
            catch (Exception)
                // When an exception occurs, the page is redirected to the error page.
                // Redirection to another (custom) page is also possible
                SPUtility.TransferToErrorPage("There is a problem to process your application.");

share|improve this question
Did you debug it to see where it is actually hanging - the code looks fine. – Max Melcher Sep 10 '12 at 10:07

Did you tried this code in Internet Explorer ? as there are problems redirecting through code for chrome and firefox and you can fix them somehow thought.

hope it helps :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.