⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 authmodule.cs

📁 asp.net技术内幕的书配源码
💻 CS
字号:
using System;
using System.Web;

namespace myModules {
	public class AuthModule: IHttpModule {

		public void Init( HttpApplication myApp ) {
		}
		
		public void Dispose() {
		}
		
		public void OnEnter( object s, EventArgs e ) {
			HttpApplication objApp;
			HttpContext objContext;
			string strPath;

			objApp = (HttpApplication)s;
			objContext = objApp.Context;
			strPath = objContext.Request.Path.ToLower();

			if ( strPath.Substring(strPath.Length-10,10) !=  "login.aspx" ) {
				if ( objContext.Request.Params["username"] == null ) {
					objContext.Response.Redirect("login.aspx");
				}
			}
		}
		
		public void OnLeave( object s, EventArgs e) {
		}
	}
}

⌨️ 快捷键说明

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