Why you try to make it harder...
There is more simple solutions
1- add html <Basetag after head..
2- make <head runat="server"then u can access it from code and add
anything you want here is example
foreach (Control ctrl in this.Master.Controls)
{
if (ctrl is HtmlHead)
{
HtmlTitle title = new HtmlTitle();
title.Text = Convert.ToString(hdt.Rows[0]["Title"]);
Literal baseurl = new Literal();
baseurl.Text = string.Format("<base href=\"{0}\">",
ConfigurationManager.AppSettings.Get("BaseURL"));
HtmlMeta desc = new HtmlMeta();
desc.Name = "Description";
desc.Content = Convert.ToString(hdt.Rows[0]["Description"]);
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "Keyword";
keyword.Content = Convert.ToString(hdt.Rows[0]["Keyword"]);
Literal additional = new Literal();
additional.Text =
Convert.ToString(hdt.Rows[0]["AdditinalHeadTags"]);
HtmlHead head = (HtmlHead)ctrl;
head.Controls.AddAt(0, title);
head.Controls.AddAt(1, baseurl);
head.Controls.AddAt(2, desc);
head.Controls.AddAt(3, keyword);
head.Controls.AddAt(4, additional);
}
"Boris Yeltsin" <borisy@nospam.nospamwrote in message
news:B04EE22B-F242-42E8-B6A0-0455825DCAC0@microsoft.com...
Quote:
>I use Master Pages, so I make use of URL rebasing through the ~ operator,
like this in the <head>:
<link runat="server" href="~/Root.master.css" media="screen"
rel="stylesheet" type="text/css" />
>
It works perfectly and the ~ gets converted by the server into the correct
relative path. Great!
>
Now, I put this in the <head>:
<script type="text/javascript" src="~/Root.master.js"
runat="server"></script>
>
And everything screws up. It looks like it's trying to compile that .js
file
into the page as the CLR throws up syntax errors and compiler errors in my
JavaScript (which is valid JavaScript).
>
What am I doing wrong? :(