Running the No Admins Analytic fix
Hello,
We run sitefinity 5.1 and for some time now I have been trying to get the No administrator users are listed when configuring Sitefintiy Analytics Fix to work, but I keep getting errors. I have dodged a few errors but this new one I can't seem to get past. Below I have attached my C# code, aspx file, and the error presented on the page. I have also maxed out the connection time out on my application pool.
C# Code(FileName: FixSFAnalyticsNoAdminUsers.aspx.cs):
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Sitefinity;using Telerik.Sitefinity.Security;using Telerik.Sitefinity.Security.Model;namespace SitefinityWebApp public partial class FixSFAnalyticsNoAdminUsers : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) var count = 0; //Get the collection of registered providers var providers = UserManager.GetManager().Providers; foreach (var provider in providers) //Load managers UserManager customproviderUsersManager = UserManager.GetManager(provider.Name); customproviderUsersManager.Provider.SuppressSecurityChecks = true; UserProfileManager profileManager = UserProfileManager.GetManager(); profileManager.Provider.SuppressSecurityChecks = true; //Get all users for this provider var customproviderUsers = customproviderUsersManager.GetUsers(); foreach (var user in customproviderUsers) //Load the user profile for each user var userProfile = profileManager.GetUserProfile(user.Id, typeof(SitefinityProfile).FullName); //If there's no profile, create one if (userProfile == null) SitefinityProfile sfProfile = profileManager.CreateProfile(user, Guid.NewGuid(), typeof(SitefinityProfile)) as SitefinityProfile; sfProfile.FirstName = user.FirstName; sfProfile.LastName = user.LastName; count++; //Commit changes profileManager.SaveChanges(); totalCount.Text = count.ToString(); aspx code (FileName: Fix.aspx):
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" CodeFile="FixSFAnalyticsNoAdminUsers.aspx.cs" Inherits="SitefinityWebApp.FixSFAnalyticsNoAdminUsers" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <div> <span>Total UserProfiles created:</span> <asp:Label ID="totalCount" runat="server" /> </div> </form></body></html>
The error is attached in the form of a .PNG
Hi Shane,
The error seems related to missing users returned or issue with the data read on that provider.
Please check and ensure that you have such users and/or ensure you can get the users from that provider.
Regards,
Svetoslav Manchev
Telerik