Log users IP address

August 21, 2008 by admin  
Filed under ASP

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
%>

Delete a file using ASP

August 21, 2008 by admin  
Filed under ASP

This example shows how to delete a file using ASP. change the file and location in the code for your own purposes.

<%
Set objFSO = CreateObject(”Scripting.FileSystemObject”)
objFSO.DeleteFile “d:\test.txt”, True
%>

Create a folder with ASP

August 14, 2008 by admin  
Filed under ASP

This snippet shows hot to create a folder in ASP

<%
Dim fso
Set fso = CreateObject(”Scripting.FileSystemObject”)
fso.CreateFolder(”d:\New Folder1″)
%>