We had developed a provider hosted app with Web Forms template for copying the content(list Items,Documents) from one site collection to another site collection,for this we are doing this using the app only calls.

To perform the copy action we created the Custom Ribbon action for the lists and document libraries and opening the Provider hosted app form in the Pop up to perform the action.


Some of the Users are reporting that randomly e getting the Error

"An error occurred while processing your request."

Also we are unable to reproduce the issue in the DEV and Test Environment.

Any suggestion how to proceed and Investigate further on this Issue.

Below is the code in the page PreInit

protected void Page_PreInit(object sender, EventArgs e)
    Uri redirectUrl;
    switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
        case RedirectionStatus.Ok:
        case RedirectionStatus.ShouldRedirect:
            Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
        case RedirectionStatus.CanNotRedirect:
            Response.Write("An error occurred while processing your request.");

Note: Most of the times the app is working fine, but randomly user are getting the above error

Update: I am opening the provider hosted app in pop up using custom actions. The command action is asbelow

 CommandAction = \"javascript:OpenPopUpPageWithTitle('" + RemoveDocumentRibbonActionurl + "', RefreshOnDialogClose, 600, 400,'" + removePopUpTitle + "');\"  EnabledScript=\"javascript: SP.ListOperation.Selection.getSelectedItems().length >= 1\"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.