Visual Studio で作成したイベント レシーバーに問題があります。特別な場合に、サイトにリダイレクトしたい。しかし、イベント レシーバーには、「イベント レシーバーが要求をキャンセルしました」というエラーが表示されたエラー ページしか表示されません。このメッセージは properties.ErrorMessage プロパティで変更できますが、リダイレクトしたいのでエラー メッセージは表示されません。これが私のコードです:
if (NoErrors == false)
{
properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
properties.RedirectUrl = SPUrlUtility.CombineUrl(properties.WebUrl, @"MyEditForm.aspx?"
+ "Mode=Upload"
+ "&CheckInComment="
+ "&ID=" + properties.ListItem.ID
+ "&RootFolder=%2Fsites%2FSuppliers%2FLists%2FDocument%20Center"
+ "&IsDlg=1"
+ "&ContentTypeId=" + properties.ListItem.ContentType.Id
+ "&IsDlg=1"
+ "&error=" + AllErrorsText);
}
私が間違っていることは何ですか?誰でも助けることができますか?前もって感謝します。
編集: 解決策: エラー変数「AllErrorsText」に相対 URL を使用し、特殊文字を使用しないでください。
string TestUrl = "MyEditForm.aspx?"
+ "Mode=Upload"
+ "&CheckInComment="
+ "&ID=" + properties.ListItem.ID
+ "&RootFolder=%2Fsites%2FSuppliers%2FLists%2FDocument%20Center"
+ "&IsDlg=1"
+ "&ContentTypeId=" + properties.ListItem.ContentType.Id
+ "&IsDlg=1"
+ "&error=" + AllErrorsTextUrl;
properties.RedirectUrl = TestUrl;
properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;