1 <% 2 Dim UserIPAddress 3 Set UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 4 If UserIPAddress = "" Then 5 UserIPAddress = Request.ServerVariables("REMOTE_ADDR") 6 End If 7 If UserIPAddress <> "" Then 8 Dim ipArr,flag,fso,f 9 ipArr = split(UserIPAddress,".") 10 UserIPAddress = ipArr(0) + "." + ipArr(1) + "." + ipArr(2) 11 flag = 0 12 set fso=server.CreateObject("Scripting.FileSystemObject") 13 Set f = fso.OpenTextFile(Server.MapPath("1.txt"),1) 14 Do While Not f.AtEndOfStream 15 'response.write f.readline 16 If UserIPAddress = f.readline Then 17 flag = 1 18 exit do 19 End If 20 loop 21 f.close 22 set f=nothing 23 set fso=nothing 24 If flag = 1 Then 25 Server.Execute("a.asp") 26 else 27 Server.Execute("b.asp") 28 End If 29 End If 30 %>