We are experiencing some performance issues with a new SharePoint 2019 project containing some custom visual web parts and user controls (farm solutions) which have been migrated from an old SharePoint 2010 ASP .NET solution.

The previous solution was built and deployed differently to a SharePoint 2010 farm and we started to move code from this solution to a new project, creating new visual web parts and user controls to simplify the deployment.

However, we started to encounter some problems like:

  • the visual web part is blocking the default.aspx page from loading quickly
  • clicking a button caused the whole page to reload
  • user controls take 15-20 seconds to load

The previous solution (which is still running) did not have any of these problems, and we have a hard time understanding why this would happen in a new solution where the code is somewhat the same just wrapped in a "different package".

To remedy the problem of having the whole page reloading when clicking any event handlers we added a UpdatePanel and this solved it, but we are still having problems with the CreatechildControls and loading of two custom user controls take well above 15-20 seconds to load.

Here's an example from the DocumentWebPart.cs:

protected override void CreateChildControls()
            if (SPContext.Current.FormContext.FormMode == SPControlMode.Edit)

            var watch = System.Diagnostics.Stopwatch.StartNew();

            var updatePanel = new UpdatePanel();

            var tableContainer = new Table();
            tableContainer.Width = Unit.Percentage(100);
            tableContainer.Height = Unit.Percentage(100);
            tableContainer.CellSpacing = 0;
            tableContainer.CellPadding = 0;

            var tableRow = new TableRow();

            var tableCell = new TableCell();
            tableCell.Width = Unit.Pixel(275);
            tableCell.Height = Unit.Pixel(600);
            //tableCell.BorderStyle = BorderStyle.Solid;
            //tableCell.BorderWidth = Unit.Pixel(1);
            tableCell.HorizontalAlign = HorizontalAlign.Left;
            tableCell.VerticalAlign = VerticalAlign.Top;

            var tableCellRight = new TableCell();
            tableCellRight.VerticalAlign = VerticalAlign.Top;

            _webTreeUserControl =
            _webTreeUserControl.Web = SPContext.Current.Web;

            _userControl =
            _userControl.Web = SPContext.Current.Web;



When debugging the solution we've so far tried to add some breakpoints in the user control life cycle events to spot any bottlenecks, but the first breakpoint that is hit is seemingly the CreateChildControls method and when analyzing the diagnostics it seems that it is somewhere between this method being initialized in the user control and the Web Part Page.LoadControl being called (see above code example).

Any ideas about what could cause this high load time when loading the user control and perhaps what could be checked next would be much appreciated.

1 Answer 1


Apparently I missed a breakpoint in the user control life cycle events and after realizing this and stepping through the code again I identified that the constructor did not throw an error when attempting to access the Active Directory and this call and the unhandled error was causing the increased load time.

Some good advice you tend to forget when under pressure is to take a break. This solves most problems :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.