Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using themed css files requires a header control on the page. (e.g. <head runat="server" />)

Tags:

I'm working on asp.net web project. When I run the project, It works correctly. But In server, I got the following error. How to solve this problem?

Using themed css files requires a header control on the page. (e.g. `<head runat="server" />`).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. How to solve this problem?

Exception Details: System.InvalidOperationException: Using themed css files requires a header control on the page. (e.g. `<head runat="server" />`).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat="server" />).]
   System.Web.UI.PageTheme.SetStyleSheet() +2458406
   System.Web.UI.Page.OnInit(EventArgs e) +8699420
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,  Boolean includeStagesAfterAsyncPoint) +378
like image 326
ozkank Avatar asked May 06 '10 18:05

ozkank


4 Answers

I feel none of the answers made above can resolve the actual issue faced by user if the page is not meant to render html. In this case, the solution is - just paste following

EnableTheming = "False" StylesheetTheme="" Theme="" 

in the @Page attribute of that page.

For example, the following source code sample:

DownloadFile.aspx.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DownloadFile.aspx.cs"
    Inherits="WebUI.Monitorization.DownloadFile"  EnableTheming="False" StylesheetTheme="" Theme=""   %>
like image 114
Suvendu Shekhar Giri Avatar answered Sep 25 '22 07:09

Suvendu Shekhar Giri


you need a head tag with runat="server" in the page (or master page) as below

<head runat="server">
    <title></title>
</head>
like image 45
Pharabus Avatar answered Sep 24 '22 07:09

Pharabus


For me the cause was missing the PrecompiledApp.config file on the live server since I pre-compile sites before uploading.

like image 40
Michael Avatar answered Sep 22 '22 07:09

Michael


Be sure to have just the files you need in the bin folder. If you have other dlls (old versions of actual dlls varying just by their name) strange-things-may-happen.

like image 38
alcor Avatar answered Sep 22 '22 07:09

alcor