function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDCDEV49SFDCDEV49 

java.lang.IllegalArgumentException: Illegal view ID 166.42.2.29. The ID must begin with /

Can any one help me on this error?.. I am trying to get the Ip address of system through a custom link.. Here is my code. ANy help will be appreciated. Thanks

 

Controller:

public

withsharingclassIpaddress {

 

public string ipaddress{get;set;}

 

publicIpaddress(ApexPages.StandardController controller) {

 

//String Ipaddress= ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');

 

}

 

 

publicstring ipvalue(){

Ipaddress= ApexPages.currentPage().getHeaders().get(

'X-Salesforce-SIP');

 

//ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'your address '+Ipaddress));returnIpaddress;

 

 

}

 

}

 

Page:

<

apex:pagestandardcontroller="Account"extensions="Ipaddress"><!-- Begin Default Content REMOVE THIS -->

<

apex:form><apex:pageblockid="test"><apex:commandLink action="{!ipvalue}"rerender="test"> ipaddress </apex:commandLink></apex:pageblock></apex:form></apex:page>

J&A_DevJ&A_Dev

Well,  your commandLink action function needs to be of type ApexPages.Action rather than String. Try something like:

 

public with sharing class Ipaddress
{ 
    public Ipaddress(ApexPages.StandardController controller) {}


    public string theIP {get;set;}

    public string theIPValue()
    {
        theIP = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');
        return theIP;
    }
    
    public PageReference retrieveIP()
    {
        String ipString = theIPValue();
        return null;
    }
 
}

 

And then the VF page:

<apex:page standardcontroller="Account" extensions="Ipaddress">
    <apex:form >
        <apex:pageblock id="test">
            <apex:commandLink action="{!retrieveIP}" rerender="test">
                ipaddress : 
                <apex:outputText value="{!theIP}"/>
            </apex:commandLink>
        </apex:pageblock>
    </apex:form>
</apex:page>

 

Hope this helps.