fanrsh

 

using System;
using System.Web;
using System.Web.SessionState;


namespace  httpmodulename
{
 
public class Moduleclass : IHttpModule 
 
{
  
public void Init(HttpApplication application) 
  

   注:asp.net开始执行httpHandlers时发生(如:用户请求xxx.aspx,xxx.asmx页面时发生)
   application.PreRequestHandlerExecute 
+= new EventHandler(this.Application_PreRequestHandlerExecute);

  }


  
private void Application_PreRequestHandlerExecute(Object source, EventArgs e) 
  
{
       执行你要的操作。。。。。(俺一般用于页面权限控制)
  }


 }

}




webconfig增加httpModules的配置
  <httpModules>
   <add name="CookieModule" type="httpmodulename.Moduleclass, Moduleclass"/> 
  </httpModules>



配置文件说明如下:
<httpModules>
   <add type="type" name="name" />
</httpModules>
type 值提供了 HTTP 模块的程序集和类名称,而 name 值提供了友好名称,可以在 Global.asax 文件中使用此友好名称来引用 HTTP 模块。

 

分类:

技术点:

相关文章:

  • 2021-09-19
  • 2018-04-11
  • 2021-12-18
  • 2021-12-27
  • 2021-12-08
  • 2021-05-15
  • 2021-11-05
猜你喜欢
  • 2022-01-07
  • 2021-08-21
  • 2021-09-02
  • 2021-10-08
  • 2021-08-24
  • 2022-01-14
  • 2021-09-19
相关资源
相似解决方案