You need to sign in to do that
Don't have an account?

get ip address in lightning component receive server erro
Hi,
i'm trying to get ip address of the client in a lightning component in a community but i receive Server error.
Any Ideas?
i'm trying to get ip address of the client in a lightning component in a community but i receive Server error.
@AuraEnabled public static String GetUserIPAddress() { string ReturnValue = ''; ReturnValue = ApexPages.currentPage().getHeaders().get('True-Client-IP'); if (ReturnValue == '') { ReturnValue = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP'); } // get IP address when no caching (sandbox, dev, secure urls) system.debug('USER IP ADDRESS: ' + ReturnValue); return ReturnValue; } // GetUserIPAddress
Any Ideas?
Thank you
put it in @auraEnabled method inside apex controller
call backed action from lightning controller
Apex CLass
Component
I'm trying to write a test class
but I receive this error:
System.UnexpectedException: Current session unavailable
Stack Trace: Class.Auth.SessionManagement.getCurrentSession: line 5, column 1 Class.siteLeadForm.GetUserIPAddress: line 18, column 1 Class.siteLeadFormTEST.Test1: line 17, column 1
do your classes also capture the community guest user ip?
Thank you in advance