I have tried this
Back Office
Try using DataBinding with ResolveUrl
<script src="<%# ResolveUrl("~/Scripts/jquery-1.5.1.min.js") %>"
type="text/javascript"></script>
Then in your code behind call the Header's Databind
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Page.Header.DataBind();
}
If you start getting errors regarding the ViewState you may need to disable it on the header.
<head runat="server" enableviewstate="false">
It seems that, you are trying to add controls to page dynamically. In this case, you can use the below code
var control = new HtmlGenericControl("script") ;
control.Attributes.Add("type", "text/javascript");
control.Attributes.Add("src", Page.ResolveClientUrl("~/scripts/jquery-1.5.1.min.js"));
//CDN will be best while hosting the application
//control.Attributes.Add("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js");
this.Page.Header.Controls.Add(control);