IP Address Tracking

  1. 5 days ago

    Jeffery L

    is not verified May 21 Testers, Xojo Pro Northwest Montana

    Is there anything attached to the session that would allow me to capture the IP Address for users attempting to login to my web app? I have had a few attempts of logins and Im not sure where it's coming from because my web apps is only in use by me currently. I just want to be able to capture an IP address and log it so that I can see whats going on.

    Session.RemoteAddress
    Use this in your Session.open Event it should work.

    message can be a string passed to this method if you want to use it for other things.

    Dim i as integer
    Dim B as Boolean

    Dim F,dbFile as FolderItem
    Dim Dt as New Date
    Dim S,R,C as String

    R = Session.RemoteAddress
    C = Dt.ShortDate + " - " + Dt.LongTime + ". Address " + R + ", " + message + EndOfLine
    F = SpecialFolder.Documents
    F = F.Child("SessionAccessLog.txt")
    If F <> NIL AND F.exists then

    Try
    Dim t as TextOutputStream = TextOutputStream.Append(f)
    t.Write C
    Catch e as IOException
    //handle error
    End Try
    End if

  2. Barney

    May 21 Answer New Zealand

    Session.RemoteAddress
    Use this in your Session.open Event it should work.

    message can be a string passed to this method if you want to use it for other things.

    Dim i as integer
    Dim B as Boolean

    Dim F,dbFile as FolderItem
    Dim Dt as New Date
    Dim S,R,C as String

    R = Session.RemoteAddress
    C = Dt.ShortDate + " - " + Dt.LongTime + ". Address " + R + ", " + message + EndOfLine
    F = SpecialFolder.Documents
    F = F.Child("SessionAccessLog.txt")
    If F <> NIL AND F.exists then

    Try
    Dim t as TextOutputStream = TextOutputStream.Append(f)
    t.Write C
    Catch e as IOException
    //handle error
    End Try
    End if

  3. Jeffery L

    is not verified May 21 Testers, Xojo Pro Northwest Montana

    Awesome! Thank you so much. That works for what I need!

  4. Tomas J

    May 21 Testers, Xojo Pro Europe (Germany)
    Edited 5 days ago

    As reminder this only works with Standalone or .CGI Webapps.

    Due to the fact that in wildlife a XOJO Web App is placed behind a Reverse Proxy you should consider that you only would see the IP address of your reverse. You have to set (on the Reverse Proxy) and to examine (in your Web app) HTTP X-Headers for the remote IP Address then.

or Sign Up to reply!