How to add script reference in Master Page to make accessible from all the directory

To add script file reference in master page to make it accessible from all the pages from all the directory of the website , add the script reference in the following way :

Suppose the web structure is as follows :

Structure of the WebSite

add following lines to masterpage.master

<head runat=”server”>
    <script type=”text/javascript” src='<%#ResolveUrl(“~/JQuery/jquery-ui-1.8.17.custom/js/jquery-1.7.1.min.js” ) %>’ ></script>
    <script type=”text/javascript” src='<%#ResolveUrl(“~/JQuery/jquery-ui-1.8.17.custom/js/jquery-ui-1.8.17.custom.min.js” ) %>’ ></script>

And then add Page.Header.DataBind();  in the OnLoad method of the MasterPage.master.cs file :

protected override void OnLoad(EventArgs e)


Thats it, now functionality from the script files are available to all the files in the website that uses the master page.