This is everyone's requirement, but unfortunately we do not have any out of box SharePoint functionality. I want to have a banner page at the top and want have a html file content as include directive. Once I modify HTML file at one place then that should get reflected all over the site. But unfortunately include directives can only work in the same application directory. so in sharepoint we cannot have the include directives.
I found an work around to resolve the issue by using the web control.
1. Create a new Web Control Library project in VS. Create a Custom Control (or use
the default one of the project.). Add the following code inside the Render
protected override void Render(HtmlTextWriter output)
string sHtml = "";
string resourceFile = @"C:\Inetpub\wwwroot\header.txt";
System.IO.StreamReader file = System.IO.File.OpenText(resourceFile);
sHtml = file.ReadToEnd() + this.Page.User.Identity.Name;
sHtml = "Error : " + ex.Message;
2. Compile the dll and put it into the GAC (Create strong name key file and add the
file path in the AssemblyInfo.cs file)
3. Add the following line in the web.config file of Sharepoint:
<SafeControl Assembly="CustomControl, Version=184.108.40.206, Culture=neutral,
PublicKeyToken=f5b8bf0a7658455a" Namespace="CustomControl" TypeName="*" />
4. Add the following line at the begin of the .aspx template:
<%@ Register Tagprefix="MyControl" Namespace="CustomControl"
Assembly="CustomControl, Version=220.127.116.11, Culture=neutral,
5. Add the following line at the place to insert the control:
6. Create a text file (C:\Inetpub\wwwroot\header.txt) containing the HTML code of