Some code I used to "include" a menu file from another server.
if (Application["menu"] != null)
{
litMenu.Text = Application["menu"].ToString();
}
else
{
try
{
System.Net.WebRequest wrq = System.Net.WebRequest.Create(ConfigurationManager.AppSettings["MenuPath"]);
System.Net.WebResponse wrp = wrq.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(wrp.GetResponseStream());
litMenu.Text = sr.ReadToEnd();
Application["menu"] = litMenu.Text;
}
catch
{
Application["menu"] = litMenu.Text;
}
}
The goal was to make our Intranet(PHP) and management backend(ASP.NET) look like the same system.