Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a question regarding SPLongOperation.

Basically i'm using it while some actions are happening, and if everything goes well it should redirect user to an other page, but if something goes wrong an error or something, it should stay on the same page and show error message.

Any idea how can i manually break SPLongOperation?

And how can i stop redirecting if error occured?

Note: im using sharepoint 2007

I have something like this:

using (SPLongOperation operation = new SPLongOperation(this.Page))
            {
                operation.Begin();

                //SOME ACTIONS               

                operation.End(redirectUrl);
            }
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

when you do operation.End() there is redirection to specified page done by MS SharePoint (see image).

Long operation end operation

What I can advise is to construct your URL to the same page when error occured using error query parameter and on postback check if error parameter is passed and display error or do whatever you have to. In this way you will "stay on the same page" and treat occured error.

Hope it helps,

Andrew

share|improve this answer
add comment

Your Answer

 
discard

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.