How do I log Ips?

RPBLEA

Active member
Joined
Apr 26, 2005
Messages
36
Programming Experience
1-3
IN asp I would I am attempting to Log an IP address and then write it to a database table? I now the element to call the IP is Request.ServerVariables("REMOTE_ADDR") but how do I initiate this and convert it to a string variable or someone read this into a database table, Anyone have any ideas?
 
This is a simple way of getting the ip into a label on the form_load event.

VB.NET:
[/size][size=2][color=#0000ff][/color][/size]
[size=2][color=#0000ff]Protected[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Page_Load([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Object[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] [/size][size=2][color=#0000ff]Me[/color][/size][size=2].Load
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].Label1.Text = Request.ServerVariables([/size][size=2][color=#800000]"REMOTE_ADDR"[/color][/size][size=2])

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff]
[/color]
 
I figured this one out, thanks Though

Dim myTime

Dim myDate

Dim struser

Dim strIP

Dim whathappened As String

myTime = DateTime.Now.AddSeconds(15).ToString("hh:mm:ss")

myDate = DateTime.Today.Date.ToShortDateString

strIP = Request.ServerVariables("REMOTE_HOST")

struser = Request.ServerVariables("LOGON_USER")

lbltime.Text = "Log Entry: Time is " & myTime & ", Date is " & myDate

 
Back
Top