我在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);
}
我做错了什么?有人可以帮忙吗?提前谢谢。
修改 解决方案:使用相对URL,错误变量" AllErrorsText"中没有特殊字符。
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;
答案 0 :(得分:0)
我自己找到了解决方案:
使用相对URL,错误变量“AllErrorsText”中没有特殊字符。
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;