Custom content module not cleaning up old URLs on Delete/Upd

Posted by Community Admin on 04-Aug-2018 13:57

Custom content module not cleaning up old URLs on Delete/Update

All Replies

Posted by Community Admin on 25-May-2011 00:00

Hi all,

Sitefinity newbie here, so please be gentle.

For all I know this may be expected behaviour, but I've noticed a couple of issues with a custom module I've created based upon the Products sample custom module.  The groundwork of the module is basically identical, but has all references to 'Products' and 'Product' swapped out for 'Cars' and 'Car'.

The first issue is that when a Car content item is removed, it does not remove its associated URLs in the table sf_url_data.  This can cause a NoSuchObjectException if a new Car content item is assigned the same URL as one which was previously deleted (full exception text at bottom of post).

The second issue is somewhat connected: when a new revision of a Car content item is published, it will create two new entries in sf_url_data without first clearing up any of the old ones.

I have to admit, I'm not quite sure where to begin with this.  Code provided on request, but as previously stated, the module data access layer etc. are basically identical to the Products sample ( http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-modules-creating-custom-modules-products-module.html )

Thanks in advance.

-Jack

No row for CarModule.Model.CarItem ('car_item') GenericOID@4e1d0d40 CarItem content_id=c19f406d-a082-4c9d-a835-2fbf0647663c NOTRES
 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: Telerik.OpenAccess.Exceptions.NoSuchObjectException: No row for CarModule.Model.CarItem ('car_item') GenericOID@4e1d0d40 CarItem content_id=c19f406d-a082-4c9d-a835-2fbf0647663c NOTRES
 
Source Error:
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 
Stack Trace:
 
 
[NoSuchObjectException: No row for CarModule.Model.CarItem ('car_item') GenericOID@4e1d0d40 CarItem content_id=c19f406d-a082-4c9d-a835-2fbf0647663c NOTRES ]
   DynamicModule.ns.Wrapped_OpenAccessProvider_00abec4545fa44aaa6b0c08113c6cd53.GetItemFromUrl(Type itemType, String url, Boolean published, String& redirectUrl) +348
   Telerik.Sitefinity.Modules.GenericContent.ContentManagerBase`1.GetItemFromUrl(Type itemType, String url, Boolean published, String& redirectUrl) +75
   Telerik.Sitefinity.Web.UI.ContentUI.ContentView.ResolveDetailItemFromUrl() +234
   Telerik.Sitefinity.Web.UI.ContentUI.ContentView.ResolveDetailItem() +745
   Telerik.Sitefinity.Web.UI.ContentUI.ContentView.CreateChildControls() +63
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

Posted by Community Admin on 30-May-2011 00:00

Hello Jack,

The product module is expected to clean up the urls in the sf_url_data on delete. It probably misses a correct parameter and fails silently. The delete request lands into the DeleteProduct method in the OpenAccessProvider class, which you can debug to check if some argument is incorrect or missing after the rename to Cars.

If it seems fine, I would suggest you to open a support ticket and send us the sample project. Then we will be able to reproduce it and give you back guidelines.

Kind regards,
George
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed