Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8204927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:03:06+00:00 2026-06-07T08:03:06+00:00

I would like to speed up the loading time for an asp.net project I

  • 0

I would like to speed up the loading time for an asp.net project I have been working on. One of the dropdownlists is a list of managers that is obtained by comparing a list of employees from a sql table to Active Directory membership.

This is called from Page_Load

        SqlDataSource empDB = (SqlDataSource)Page.Master.FindControl("EmployeeData");
        DataView dv = (DataView)empDB.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in dv)
        {
            employeeList.Add(new Employee(int.Parse(drv["EMP_ID"].ToString()), drv     ["FULL_NAME"].ToString()));
        }

        managerTest();

        managerDropDownList.DataSource = managerList;
        managerDropDownList.DataTextField = "fullName";
        managerDropDownList.DataValueField = "emp_Id";
        managerDropDownList.DataBind();

The manager test method:

     private void managerTest()
    {

        PrincipalContext domainContext = new PrincipalContext(ContextType.Domain, "the_domain");
        GroupPrincipal managersGroup = GroupPrincipal.FindByIdentity(domainContext, "Managers and Supervisors");
        GroupPrincipal offManagersGroup = GroupPrincipal.FindByIdentity(domainContext, "Office Managers");
        GroupPrincipal executivesGroup = GroupPrincipal.FindByIdentity(domainContext, "Executives");
        GroupPrincipal managers2Group = GroupPrincipal.FindByIdentity(domainContext, "Managers");

        foreach (Employee emp in employeeList)
        {
            UserPrincipal user = UserPrincipal.FindByIdentity(domainContext, emp.fullName);

            if (user != null)
            {
                if (user.IsMemberOf(managersGroup) || user.IsMemberOf(offManagersGroup) || user.IsMemberOf(executivesGroup) || user.IsMemberOf(managers2Group))
                {
                    managerList.Add(emp);
                }
            }
        }

    }

Employee is just a simple class that separates the values for first name, last name and full name.

The issue is that the page loads really slow and there are several controls on the page that postback and causes the postback to take a long time. Is there anything I can do to make this work more efficiently?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:03:09+00:00Added an answer on June 7, 2026 at 8:03 am

    A couple things. First. You should wrap all code you posted in page_load in a if (!IsPostBack). You only need to bind that one time, not every time the page loads. Unless you’ve turned off viewstate of course.

    Second. How often do managers change? Probably not that often. I would recommend storing this in the asp.net Cache. Heck, you might want to do cache it in Global.asax Application_Start. Otherwise, the first person to visit the page will get a performance hit. But that’s certainly much better then loading it EVERY TIME someone visits the page. And then you CAN turn off viewstate on the page if you want.

    Next. I think the way you are using AD is very inefficient. You are calling it for EVERY employee in a loop. And the only reason why you are doing that is to find out if they are a manager. Instead of doing it that way, find out who all the managers are first. In other words: call AD to get the members of the groups you care about. See this question: get all users from a group in Active Directory for how you can find all the members of an AD group. I suspect that would REALLY help with performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing Ant project and would like to speed up the build
I would like to improve the loading speed of the Shadowbox popup images on
I would like to check the load speed of each page in a particular
I would like to know if there is a difference in speed between computing
I am just coming up to speed on WPF and would like to create
I have used tools such as YSlow to measure the loading speed of our
I have been tasked with optimizing a marketing landing page for speed. It already
I'm working on an ASP.Net application and working to add some Ajax to it
So, I have a .NET program doing batch loading of records into partitioned tables
First, I would like to know if this query is Lazy loading or Eager

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.