How to let ASP program select the server nearest to the visitor
S T E P - 1
- We need to know where the visitor comes from!
- We can get the value of REMOTE_HOST to detect the location of the visitor.
<%
Dim strRemoveHost
Dim strCountry
strRemoveHost = Request.servervariables("REMOTE_HOST")
strCountry = UCase(Right(strRemoveHost,2)) ' Get the country code
%>
S T E P - 2
- After that, we can select which web server that the user can use.
<%
Dim strRemoveHost
Dim strCountry
strRemoveHost = Request.servervariables("REMOTE_HOST")
strCountry = UCase(Right(strRemoveHost,2)) ' Get the country code
Select Case strCountry
Case "JP"
Request.redirect "http://www.mywebsite.com.jp"
Case "TW"
Request.redirect "http://www.mywebsite.com.tw"
End Select
%>
No comments:
Post a Comment