http://blog.csdn.net/firewolffeng/archive/2007/12/13/1933694.aspx

 

/*含有iframe tag的页面*/

MyHandler.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace MyNameSpace
{
    public class MyHandler : IHttpModule
    {
        public void Init(HttpApplication application)
        {
            application.AcquireRequestState += new EventHandler(application_AcquireRequestState);
        }

        public void application_AcquireRequestState(object sender, EventArgs e)
        {
            HttpApplication app = (HttpApplication)sender;

            if (app.Context.Request.Path.ToUpper() == "/aes/cTrace/logon.aspx".ToUpper())
                return;
            if (app.Context.Request.Path.ToUpper() == "/aes/cTrace/logonMenu.aspx".ToUpper())
                return;
            if (app.Context.Request.Path.ToUpper() == "/aes/cTrace/treePlaceHolder.aspx".ToUpper())
                return;
            if (app.Context.Request.Path.ToUpper() == "/aes/cTrace/logonMain.aspx".ToUpper())
                return;

            if (app.Context.Session["userName"] == null || app.Context.Session["userName"].ToString().Trim() == "")
            {
                app.Context.Server.Transfer("/aes/cTrace/logon.aspx");
            }
        }