This topic is locked

Capturing the ipval

11/5/2006 7:15:56 AM
ASPRunnerPro General questions
E
ebolisa author

Hi,

I'm using a table to log the user's name and time of connection. I'd like to log the user IP address as well but just cannot seem to make it work. How can I capture the IP value?

TIA

Emilio

C
chris 11/6/2006

Depends on what system you are using, additional information will be needed.

OS Server type and version, IIS type and version to start.

Also DB type and version.

Hope that helps,

Chris.

Sergey Kornilov admin 11/6/2006

Emilio,
you can use the following:

Request.ServerVariables("remote_addr")
E
ebolisa author 11/6/2006

Thank you Sergey.

At the moment I've the following code:
<%

Sub AfterSuccessfulLogin()

'** Insert a record into another table ****

strSQLInsert = "insert into dbo.logger (User_id) values ('" & Session("ownerID") & "')"

dbConnection.Execute strSQLInsert

End Sub

%>
World this be ok?

...

strSQLInsert = "insert into dbo.logger (ipadd) Request.ServerVariables("remote_addr")"

...

(my server is down and cannot test it)

TIA,

Emilio

J
Jane 11/7/2006

Here is a correct SQL:

strSQLInsert = "insert into dbo.logger (ipadd) values ('" & Request.ServerVariables("remote_addr") & "')"