Monday, October 19, 2009

Sitecore CMS 6 - Pagination from the shell User Manager with a custom Membership Provider

When I connected a custom Membership Provider to Sitecore.NET 6.1.0 (rev. 090821) I noticed the performance was degrading badly as the number of custom members increased. Some investigation into the calls coming out of Sitecore showed that pageIndex was always 0 and the pageSize always int.MaxValue regardless of the actual page required. I.e.:

//Sitecore requests the first 15 records - expected pageIndex = 0, pageSize = 15
CustomMembershipProvider.GetAllUsers(int pageIndex = 0, int pageSize = int.MaxValue, out int totalRecords);

//Sitecore requests the second 15 records - expected pageIndex = 1, pageSize = 15
CustomMembershipProvider.GetAllUsers(int pageIndex = 0, int pageSize = int.MaxValue, out int totalRecords); 

//Sitecore requests the third 15 records  - expected pageIndex = 2, pageSize = 15
CustomMembershipProvider.GetAllUsers(int pageIndex = 0, int pageSize = int.MaxValue, out int totalRecords); 

//...

I checked with Sitecore and this is a known issue that will be resolved in an upcoming release. In the short term it can be patched by adding the ManualPaging="true" attribute to the ComponentArt Grid in \sitecore\shell\Applications\Security\UserManager\UserManager.aspx.