Home

Keebler/Blog

« Creating cool clickable wireframes for crude cash
Liberal-NDP Coalition: Facts »

ASPX: Don’t put UserControls inside of code blocks

I was trying to figure out why an ASPX page was taking so long to render. I put time markers all through my code, but the slowdown was happening between the end of the Page_Load execution, and the beginning of the page render. There were no exceptions or anything.

Finally, by a painful process of elimination, it turned out to be a block of code like this in the ASPX file. At render, it was deciding whether to include a custom UserControl. While the code executed properly, the only hint of a problem was iistrace showing “IISISAPI: ISAPI_END – IIS ends processing an ISAPI Request” taking a long time.

<% if( IsSomething ) { %>

    <%@ Register src="~/Sidebar.ascx" tagname="SiteSidebar" tagprefix="MySite" %>
    <MySite:SiteSidebar runat="server" />

<% } %>

If you want to save yourself hours of grief, don’t do this :D I wonder if this is the problem with a certain video player ;)

Tags: asp.net, C#

Related Posts

  • .NET: Monitoring Windows processes from ASPX webpage
  • Cojax Source Code Viewer
  • Bar Code Clock in Javascript
  • New drug blocks HIV from entering cells
  • Inside-out burrito and waiting…

This entry was posted on Sunday, November 30th, 2008 at 8:18 pm and is filed under Web Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “ASPX: Don’t put UserControls inside of code blocks”

  1. Rian says:
    December 1, 2008 at 6:24 pm

    Haha, I didn’t know people even still wrote inline code since asp.net arrived. It must’ve been a stubborn coder who wrote that. ;)

  2. Jonathan says:
    December 3, 2008 at 1:44 am

    It was I! :) There are some times where it’s a heck of a lot more efficient to use code blocks than always binding to controls.

Leave a Reply

Click here to cancel reply.

  • Blog Home

  • Tags

    90210 alessandra ambrosio animals asp.net audrina patridge battlestar galactica bikini bunny bush C# canada canada election ctv ctvglobemedia development Election Entertainment/Celebrity facebook Gordon Ramsay gorilla gossip girl hayden panettiere iphone last.fm liveblog liveblogging mesh08 muchmusic Music obama palin rachel bilson scribblelive shenae grimes subway telemarketers the hills the killers the office toronto ttc toronto tv us election video yeah yeah yeahs

    WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

  • Recent Posts

    • Kenny (vs. Spenny) livebloggin…
    • Trying to convince @idiotbante…
    • I wonder if the CTV “Save Loca…
    • Just finished dinner which I m…
    • I shouldn’t get as excited abo…
  • Categories

    • Election
    • Entertainment/Celebrity
    • Fake News
    • Featured
    • Funny
    • Keebler/Show
    • Music
    • My Releases
    • On-the-Road
    • RedDot
    • Reviews
    • Science/Technology
    • ScribbleLive
    • Security
    • Software
    • Torrent Live Stats
    • Tweets
    • Uncategorized
    • Web Development
  • Blogroll

    • Kitten-Monkey’s Cell
    • :: kattekylling ::
    • Adam Finley
    • blog-j
    • fuzzz.gaulin.ca
    • Idiot Banter
    • mad.greyarea.com
    • ob.blog
    • PollyPrissyPants
    • RedDot CMS Users Google Group
    • ScribbleLive Official Blog
  • My Sites

    • Flickr2Facebook
    • RedDot CMS
    • ScribbleLive
    • Where are my f(acebook)ing friends?
    • WhyYouShould