Progged programming site

Programming source code, articles, tutorials, links and chat

Log users IP address

This ASP example will retrieve a visitors IP address and store it in a file called log.txt. Note that the text file has to exist, you could of course create this or have some sort of validation that the file exists first.

<%
IPAddress=Request.ServerVariables (”REMOTE_ADDR”)
Set objFSO = CreateObject(”Scripting.FileSystemObject”)
Set objFile = objFSO.OpenTextFile(”c:\log.txt”, forappending)
objFile.WriteLine (IPAddress)
objFile.close
Set objFile=nothing
Set objFSO=nothing
%>

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Sponsors