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 1061911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:32:40+00:00 2026-05-16T18:32:40+00:00

My asp.net app is heavily using user controls and is high load; my concern

  • 0

My asp.net app is heavily using user controls and is high load; my concern is that loading user controls for every request (Page.LoadControl(controlPath)) is sub-optimal at best. I was thinking of caching an instance of loaded user control in HttpRuntime, but I don’t know how’s it going to behave when multiple connections (threads) will try to fetch it from the cache and modify properties – I guess trouble is waiting there.
Any good way to optimize user control loading?

Again, I am talking about caching user control, not it’s html output (which it makes no sense caching as it’s [html output] going to be different every time you use it)

Thanks!

  • 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-05-16T18:32:41+00:00Added an answer on May 16, 2026 at 6:32 pm

    Do not cache a user control, or anything that inherits from WebControl, ever.

    The reason is that it contains a reference to the Page instance on which it is instantiated. By caching the control, you are effectively caching the Page and the entire control subtree with it. You’re right when you say that there is trouble waiting there!

    Far, far better to cache the data that your usercontrol needs, create a new usercontrol and initialize it with the data.

    Some other suggestions for optimization:

    • If you’re only using one or two controls per page, rather than loading them dynamically, just declare them as part of the page and set their visibility to false initially, and then to true when you need them.

    • If usercontrols are really just too slow for you, you could try rewriting it as a WebControl and set up the layout in code. I’m not sure if the extra work would be worth any optimizations that might be gained there.

    I wouldn’t pre-optimize anything until you know it’s an issue. Are you actually running into performance problems with LoadControl()?

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

Sidebar

Related Questions

I've got an ASP.NET app using NHibernate to transactionally update a few tables upon
I have an ASP.NET app running in IIS that is hosting files all great
I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath
Im working on an ASP.Net app with c#. I am stuck on a problem
A classic ASP.NET app - AppSrv + MS SQL DB. Both servers are heavy-lifters
I'm creating an asp.net app with just some lite data access from xml files.
I have an asp.net app and I am trying to save a text file
We have CC.NET setup on our ASP.NET app. When we build the project, the
I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP
I'm doing something bad in my ASP.NET app. It could be the any number

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.