0

「タスク」リストにイベント レシーバーを作成しました。

「期日」が「期日」の場合null、ユーザーはカスタム エラー ページにリダイレクトされます。

カスタム エラー ページは、"Layouts" ディレクトリの下の SharePoint マップ フォルダーにあります。

イベント レシーバーのコードは次のとおりです。

public override void ItemAdding(SPItemEventProperties properties)
{
    try
    {
        if (properties.AfterProperties["Due Date"] == null)
        {
            properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
            properties.RedirectUrl = "_layouts/CustomErrorPage/DueDateErrorPage.aspx";
        }
    }
    catch (Exception ex)
    {

    }
}

名前を持つ「アプリケーション ページ」タイプのカスタム エラー ページ。"DueDateErrorPage.aspx". マークアップは次のとおりです。

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
ERROR : You cannot create the task without due date
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Custom Error Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea"     ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
Custom Error Page
</asp:Content>

IIS では、_layouts ディレクトリの下でページが利用可能ですが、この出力が得られます。

ここに画像の説明を入力

このエラーにどのように対処すればよいですか? 助けてください。

4

2 に答える 2