IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
The following tutorial demonstrates creating a full implementation of a web service that takes care of removing orphaned UserProfile objects from Sitefinity CMS.
The service will support deleting orphaned user profiles for a single user or for all users from a specified MembershipProvider. To do that you need to define two Request DTOs handling the delete by user ID and delete by providerName operations. Both Request DTO have the route specified. In this case the route is the same, but when used for deleting orphaned profiles for a single user it accepts a UserId parameter. The same route is used for deleting all orphaned profiles for users under a particular membership provides, when a ProviderName parameter is passed.
You also need to define the matching Response DTOs:
In the service implementation you must implement two separate methods responsible for handling the business logic matching the respective Request DTO and route you already defined. The first method is responsible for deleting orphaned profiles for a single user, while the second one takes care of deleting orphaned profiles for all users in a specified membership provider.
In the plugin you must implement the IPlugin interface and inside the Register method specify the type of the service you want to register:
Once you have all the components ready you must register the plugin in your Global.asax:
As a result, you can consume your new web service by calling it:
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important