zoukankan      html  css  js  c++  java
  • asp.net httpmodule 访问页面控件 备忘

    用到的时候发现还得找代码,存一个例子方便自己和他人修改:

    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
        }
    }
  • 相关阅读:
    linux tar order
    Linux驱动学习步骤(转载)
    汇编指令(转载)
    拓扑排序
    python 三维坐标图
    python 矩阵
    spring 之 IOC 依赖注入详解
    spring 下载
    Struts数据验证
    拦截器配置
  • 原文地址:https://www.cnblogs.com/nanfei/p/4953949.html
Copyright © 2011-2022 走看看