Hmmm… I'm creating an RSS Feed page on one of my new apps I'm working on (yet another Blog <g>)…
The site uses themes but when I'm generating the Rss.aspx page which looks like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Rss.aspx.cs"
Inherits="Westwind.WebLog.Rss"
EnableTheming="false" EnableSessionState="false" %>
But ASP.NET complains about the fact that the header is missing:
Exception Details: System.InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat="server" />).
This even though EnableTheming is off for the page.
In order to get this to work I have to drop in the HTML header like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Rss.aspx.cs"
Inherits="Westwind.WebLog.Rss"
EnableTheming="false" EnableSessionState="false" %>
<head runat="server" id="Header" />
It doesn't matter for my RSS page since the XML is generated directly into the Response.OutputStream(), but this adds a little unneeded overhead into the page. But if you had a page that wanted to use the ASPX content to generate some non-HTML output that doesn't include a header you'd have to explicitly set the header visible=false I guess.
So to generate a page that shows just your text and no header:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebLog.WebForm1" %>
<head runat="server" visible=false/>This is a test
I guess this is not a big deal, but seems like an oversight in the page parser.
Other Posts you might also like