Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8282355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:20:43+00:00 2026-06-08T10:20:43+00:00

I have an aspx page with a head <head runat=server id=head> <title></title> </head> Now

  • 0

I have an aspx page with a head

<head runat="server" id="head">
    <title></title>
</head>

Now the site I am working on is pulling information from a xml file and I want to take a node from the xml file and append it to the head section.

 <head runat="server" id="head">
        <title></title>
        <script></script> // comes from the xml file
    </head>

However when I try to either one of these.

  protected void Page_Init(object sender, EventArgs e)
    {


        this.Page.Header.InnerHtml += xml.Header; // errors out
        this.Page.Header.InnerHtml = this.Page.Header.InnerHtml + xml.Header; // errot ut

    }

It errors out

System.Web.HttpException was unhandled by user code Message=Cannot
get inner content of head because the contents are not literal.

If I do this

protected void Page_Init(object sender, EventArgs e)
        {


            this.Page.Header.InnerHtml = xml.Header; 


        }

all is fine.

If I do this

<head runat="server" id="head">
   // removed the title tag so now nothing is in head
</head>

and then do this

protected void Page_Init(object sender, EventArgs e)
        {


            this.Page.Header.InnerHtml += xml.Header; // works
            this.Page.Header.InnerHtml = this.Page.Header.InnerHtml + xml.Header; //works

        }

It works. So I am not sure why it fails when there is tags inside the head already.

If I also try to get the contents from the head as well I get the same error

 var a = this.Page.Header.InnerHtml;
var a = this.Page.Header.InnerText;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:20:44+00:00Added an answer on June 8, 2026 at 10:20 am

    This issue might be due to the way the head tag is getting rendered with the script tag in it

    It can also be that the page is getting render too quickly

    I would suggest that you try insert the script tag in the head tag while page is getting Page_PreRender event

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is what I have in the aspx page: <head runat=server> <title>Website - <asp:ContentPlaceHolder
I have the following ASPX page: <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title></title> <script src=js/jquery-1.2.6.min.js
I have an aspx page defined as follows: <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script
I have an aspx page showing lots of information in a tabular format on
I have an ASPX Page: <%@ Page Language=C# MasterPageFile=~/site.Master AutoEventWireup=true CodeBehind=Default.aspx.cs Inherits=myProject.Presentation.Web.Default src=Default.aspx.cs %>
I have an aspx site: <%@ Page Language=C# AutoEventWireup=true CodeBehind=Download.aspx.cs Inherits=ATP.Management.Web.Download %> <!DOCTYPE html
I have one aspx Page in that i have to Print Title in betwen
I have an aspx page with a few textboxes and a submit button. Once
I have an ASPX page .In the Top i am displaying 5 categories (Ex
I have an ASPX page with two RequiredFieldValidator and a button to go to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.