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
I wonder if this is the problem with a certain video player ![]()
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.
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.