Forums: Restricting Access To Asprunnerpro Application By Ip Address - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Restricting Access To Asprunnerpro Application By Ip Address

#1 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16045
  • Joined: 03-February 03

Posted 11 July 2013 - 09:10 PM

Restricting or allowing access by IP address is an easy task. Here are a few examples. This code needs to be added to the beginning of AfterAppInit event. Please note that this tutorial uses IPv4 addresses.

1. Allow local access only

if Request.ServerVariables("REMOTE_ADDR")<>"127.0.0.1" then Response.End 


2. Allow access from the list of approved IP addresses.

Dim arr(2) 
arr(0) = "127.0.0.1"
arr(1) = "127.0.0.2"
arr(2) = "127.0.0.3"
bGood=false
For Each item In arr
	if item = Request.ServerVariables("REMOTE_ADDR") then
		bGood=true
		Exit For
	end if
Next
if not bGood then Response.End


3. Restrict access from a certain IP address

if Request.ServerVariables("REMOTE_ADDR")="96.23.12.124" then Response.End 


4. Restrict access from the list of addresses

Dim arr(2) 
arr(0) = "127.0.0.1"
arr(1) = "127.0.0.2"
arr(2) = "127.0.0.3"
For Each item In arr
	if item = Request.ServerVariables("REMOTE_ADDR") then
		Response.End
	end if
Next

Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic