Skip to main content
4 of 4
edited tags
Eric Alexander
  • 43.3k
  • 10
  • 54
  • 93

SharePoint 404 not found when canceling an item event

I have a SharePoint 2007 list with an event receiver, its logic is very simple:

public override void ItemDeleting(SPItemEventProperties properties)
    {
        //Base event
        base.ItemDeleting(properties);

        //Ready 2 use variables
        bool cancel = true;

        //If the permissions are valid
        if (validPermissions(properties))
            cancel = false;
        else
            cancel = true;

        properties.ErrorMessage = "You cannot delete the item, please verify your permissions";
        properties.Cancel = cancel;
        SPUtility.Redirect(properties.OpenWeb().Url + "/Pages/AssessmentCatalog.aspx", SPRedirectFlags.Static, HttpContext.Current);

    }    

When deleting an item and the event gets canceled (I mean the boolean becomes true) I get an error message:

Server Error 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

The URL is the following:

http://SOMESITESURL/_vti_bin/owssvr.dll?CS=65001&Cmd=Delete&List={BDCE6E94-F630-4C4A-B631-7D53C8568E61}&ID=45&NextUsing=SOMESITEURL

The thing is, it only happens when the event gets canceled, otherwise it deletes the item correctly and I cannot figure out why is this happening.

Can you please help me?