thememodule.cs

来自「ASP.NET2.0(C#篇)经典教程的源码...本源码很好的实现了购物车...」· CS 代码 · 共 28 行

CS
28
字号
using System;
using System.Web;
using System.Web.UI;

namespace Wrox.Web.GlobalEvents
{
  public class ThemeModule : IHttpModule
  {
    public void Init(HttpApplication context)
    {
      context.PreRequestHandlerExecute += new EventHandler(this.app_PreRequestHandlerExecute);
    } 

    private void app_PreRequestHandlerExecute(object Sender, EventArgs E)
    {
      Page p = HttpContext.Current.Handler as Page;
      if (p != null)
      {
        ProfileCommon pb = (ProfileCommon)HttpContext.Current.Profile;
        p.Theme = pb.Theme;
      }
    }

    public void Dispose()
    {
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?