A frase mais simples é usar o seguinte:
ip = request.servervariables ("remote_addr")
Response.Write (IP)
No entanto, esse método não é preciso para os servidores proxy acessarem a Internet; portanto, o método mais abrangente é usar o seguinte método:
A cópia do código é a seguinte:
<%PrivatefunctionGetip ()
Dimstripaddr
Ifrequest.Servervariables ("http_x_forwarded_for") = "" orinstr (request.servervariables ("http_x_forwarded_for"), "desconhecido")> 0hen
Straaddr = request.Servervariables ("Remote_addr")
Elseifinstr (request.servervariables ("http_x_forwarded_for"), "," ")> 0hen
StraadDr = MID (request.Servervariables ("http_x_forwarded_for"), 1, instrum (request.servervariables ("http_x_forwarded_for"), ")-1)
Elseifinstr (request.servervariables ("http_x_forwarded_for"), ";")> 0hen
StraadDr = MID (request.Servervariables ("http_x_forwarded_for"), 1, instrum (request.servervariables ("http_x_forwarded_for"), ";";)-1)
Outra pessoa
StraadDr = request.Servervariables ("http_x_forwarded_for")
Endif
getip = Trim (Mid (Straaddr, 1,30))
Função final
ip = getip ()
Response.Write (IP)
%>