asp.Nethttpmoduleアクセスページコントロールメモ
2774 ワード
使用するときは、コードを探して、自分と他の人が修正しやすい例を保存する必要があります.
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace FirsteLite.OMS.HttpModule
{
public class CommonHttpModule : IHttpModule
{
#region IHttpModule
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
}
void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
if (HttpContext.Current.Handler is Page)
{
Page page = (Page)HttpContext.Current.Handler;
page.PreRender += delegate(object ss, EventArgs ee)
{
//if (page is CDefault)
//{
// page.ClientScript.RegisterClientScriptInclude("key", page.ResolveUrl("~/myjs.js"));
//}
page.Header.Controls.AddAt(0,new Literal {
Text = "<meta name=\"renderer\" content=\"webkit,ie-stand\" />" + Environment.NewLine +
"<meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1,IE=8\" />" + Environment.NewLine
});
};
}
}
#endregion
}
}