I was using Theme in my application and instead of putting in all pages , I used it through web.config file .
But for some of my pages the application was throwing following Exception
System.InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat="server" />).
at System.Web.UI.Page.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Which means that all my pages should have runat=”server” in the <head> tag, like the following:
But for some pages it was difficult to use the <head> tag like the pages for not rendering ‘text/html’ content and as a result of which it was throwing Exception.
So here is the solution
Set EnableTheming = "False" StylesheetTheme="" Theme="" at the specific page level in the @Page attribute.