global.asax.cs
来自「IP锁定程序实例源码 ip focus program example reco」· CS 代码 · 共 36 行
CS
36 行
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
namespace BlockIP
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
//http://www.svnhost.cn
//QQ:4111852
//系统启动时调用
//从数据库或者文件取出屏蔽掉的IP放入Application
//edit by 51aspx.com
Hashtable hash = new Hashtable();
hash.Add("127.0.0.1", string.Empty);//用127.0.0.1来测试
hash.Add("32.44.54.77", string.Empty);
hash.Add("132.44.54.77", string.Empty);
hash.Add("31.44.54.77", string.Empty);
hash.Add("21.44.54.77", string.Empty);
//加入了4个IP
Application["blockip"] = hash;
}
protected void Application_End(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?