I am looking for a way to identify if a Web control contains server blocks in code, without necessarily parsing the entire file or scanning for specific tags.
The reason for this requirement is because I have numerous old Web forms that were created without considering HTML standards. The header control, located within the body tag on every page, includes a link tag that references the main stylesheet of the site. By verifying that the head tag does not contain server blocks, I can dynamically insert the link tag into Page.Controls.OfType(Of HtmlHead).First(), and then hide the unnecessary link tag.
These are all legacy components, originally written in .NET 1.1 days and now converted to 3.5. Due to time and budget constraints, transitioning everything to a master page is not feasible. Nonetheless, it would be beneficial to have the pages load with the stylesheet already applied, rather than rendering without styling and then applying the stylesheet later in the body.