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
        }
    }
  • 相关阅读:
    Kafka 生产者 自定义分区策略
    同步互斥
    poj 1562 Oil Deposits(dfs)
    poj 2386 Lake Counting(dfs)
    poj 1915 KnightMoves(bfs)
    poj 1664 放苹果(dfs)
    poj 1543 Perfect Cubes (暴搜)
    poj 1166 The Clocks (暴搜)
    poj 3126 Prime Path(bfs)
    处理机调度
  • 原文地址:https://www.cnblogs.com/nanfei/p/4953949.html
Copyright © 2011-2022 走看看