zoukankan      html  css  js  c++  java
  • 单空间多域名绑定

    using System;
    using System.Diagnostics;
    using System.Threading;
    using System.Web;
    using System.Xml;
    using System.Text.RegularExpressions;
    namespace etnews.BLL
    {    
        
    public class HelloWorldModule : IHttpModule {
            
    public String ModuleName { 
                
    get { return "HelloWorldModule"; } 
            }    
            
            
    // In the Init function, register for HttpApplication 
            
    // events by adding your handlers.
            public void Init(HttpApplication application) {
                application.BeginRequest 
    += (new EventHandler(this.Application_BeginRequest));
                application.EndRequest 
    += (new EventHandler(this.Application_EndRequest));
            }
            
            
    // Your BeginRequest event handler.
            private void Application_BeginRequest(Object source, EventArgs e) {
                HttpApplication application 
    = (HttpApplication)source;
                HttpContext context 
    = application.Context;
                
    string strRawUrl = HttpContext.Current.Request.RawUrl;
                HttpContext.Current.Response.Redirect(
    "http://www.gegew.com");
            }
            
            
    // Your EndRequest event handler.
            private void Application_EndRequest(Object source, EventArgs e) {
                HttpApplication application 
    = (HttpApplication)source;
                HttpContext context 
    = application.Context;
                context.Response.Write(
    "<hr><h1><font color=red>HelloWorldModule: End of Request</font></h1>");
            }        
            
            
    public void Dispose() 
            {
            }
        }
    }

    如果不是在web项目里面需要手动添加对System.Web的引用
    下面是WEB.config的设置
        <!-- 多域名支持 -->
        
    <httpModules>
          
    <add type="etnews.BLL.HelloWorldModule, etnews.BLL" name="HttpModule" />
        
    </httpModules>
    添加到system.web节点内
  • 相关阅读:
    nodejs学习(一) ---- nodejs + express应用生成器 快速创建应用
    canvas学习--准备
    react初探索--react + react-router + ant-design 后台管理系统配置
    css3新特性学习系列 -- border
    微信小程序 video组件 不随页面滚动
    将日志搬家到自己的站点 http://nowhereman.cn/
    【转】- 使用T4模板批量生成代码
    [WinForm]- 设置DataGridView单元格内根据不同值显示图片
    [转]- Winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值
    [MVC]
  • 原文地址:https://www.cnblogs.com/Excellent/p/787062.html
Copyright © 2011-2022 走看看