Page view counter

Must have a <head runat="server"> Error

Last post 03-07-2008 5:14 AM by eryn. 9 replies.

Sort Posts:

  • Must have a <head runat="server"> Error

    03-02-2006, 10:59 AM
    • Loading...
    • leoguy
    • Joined on 02-23-2006, 10:00 PM
    • Posts 48
    • Points 121

    When i use <atlas:ScriptManager> tag in .aspx or .ascx pages without <head runat =server> , i get the following error. Is this a bug or as designed?

     

    Server Error in '/AtlasWebSite' Application.

    Must have a <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.

    Exception Details: System.InvalidOperationException: Must have a <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: Must have a <head runat="server">]
       Microsoft.Web.UI.ScriptManager.OnPreRender(EventArgs e) +262
       System.Web.UI.Control.PreRenderRecursiveInternal() +77
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:31 AM
    • Loading...
    • Aidy
    • Joined on 09-01-2005, 2:35 PM
    • UK
    • Posts 711
    • Points 3,585
    As designed, you need that runat attribute.
  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:31 AM
    • Loading...
    • LordHits
    • Joined on 07-22-2002, 10:22 AM
    • Lisle, IL USA
    • Posts 104
    • Points 520
    I got this too (which is easily fixed by making the head runat="server") but is this a requirement on any page using Atlas?
  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:42 AM
    • Loading...
    • XIII
    • Joined on 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 12,638
    • Points 109,610
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    LordHits wrote:
    but is this a requirement on any page using Atlas?

    Hi,

    no it isn't. If you're using Themes in ASP.NET 2.0 it's required to have that attribute.

    Grz, Kris.

  • Re: Must have a <head runat="server"> Error

    03-02-2006, 11:50 AM
    • Loading...
    • leoguy
    • Joined on 02-23-2006, 10:00 PM
    • Posts 48
    • Points 121

    But i am not using any themes in my website which is fairly simple ASP.NET 2.0 impelementation. Infact i am using Atlas in .ascx control and .ascx control is loaded first then the page, as a result scripmanager is unable to see the <head runat=server> tag and generates this error.

    Any clue?

     

  • Re: Must have a <head runat="server"> Error

    03-02-2006, 12:15 PM
    • Loading...
    • LordHits
    • Joined on 07-22-2002, 10:22 AM
    • Lisle, IL USA
    • Posts 104
    • Points 520
    XIII wrote:

    Hi,

    no it isn't. If you're using Themes in ASP.NET 2.0 it's required to have that attribute.

    Grz, Kris.

    Ok, but i'm not using themes and I still go that message. I don't know if it matters, but my scriptmanager control resides in a content page as opposed to the master page.

  • Re: Must have a <head runat="server"> Error

    06-01-2006, 4:59 PM
    • Loading...
    • gbecavin
    • Joined on 06-01-2006, 8:53 PM
    • Posts 6
    • Points 30

    Hi,

    I had the same problem. An .aspx page with a placeholder, loading an ascx control in code behind.

    I replace the <head> section in my aspx page with <head id="headSection" runat="server" >,  and now it works.

    As the ascx control had an updatepanel, i had to do the loadcontrol in the page-init method.

    Hope that will solve your pb.

    Gilles

  • Re: Must have a <head runat="server"> Error

    06-01-2006, 6:07 PM
    • Loading...
    • Luis Abreu
    • Joined on 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • Points 25,660
    • TrustedFriends-MVPs

    hello guys.

    i believe that the head element must be a server element since it's one of the sections that is sent back from the server to the client during a partial postback (ie, it's contents are parsed and send on every partial postback response).

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Must have a <head runat="server"> Error

    10-11-2006, 2:00 AM
    • Loading...
    • ullaskumar_v
    • Joined on 10-11-2006, 5:55 AM
    • Posts 2
    • Points 7

    Hi,

    If you are using Master pages.. then have to make sure that <head runat="server">  is there in the master page.

    regards,

    ukv

  • Re: Must have a <head runat="server"> Error

    03-07-2008, 5:14 AM
    • Loading...
    • eryn
    • Joined on 12-10-2007, 1:54 AM
    • Posts 10
    • Points 5

    I'm spitting out the page via xml, so I can't add the runat="server" at design time, is there some way I can add it in the OnPreInit method maybe??

Page 1 of 1 (10 items)