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
Hazem LotfyHazem Lotfy 

Invalid session

When redirecting to a page and passing the session as a parameter using UserInfo.getSessionId() I am getting invalid session id. This was working last week.

here is the apex code:

private String buildFP_URL()

    {
        String serverUrl = 'https://' + ApexPages.currentPage().getHeaders().get('Host') + '/services/Soap/u/15.0/' + UserInfo.getOrganizationId().substring(0, 15);
        String sessionId = UserInfo.getSessionId();
        String oName = opp.Name;
       
        String encodedOname = EncodingUtil.urlEncode(oName , 'UTF-8');
        String fpServer = 'https://sbx.fpx.com';     
        return fpServer +'/login/connect.do?destination=quote"eName=' + encodedOname+ ' Quote&SfdcOpId=' + opp.Id + '&SfdcOpName=' + encodedOname+ '&SfdcServerURL=' + serverUrl + '&SfdcSessionID=' + sessionId;
       

is there a reason why the call UserInfo.getSessionId() would not return a valid session.

Best Answer chosen by Admin (Salesforce Developers) 
spraetzspraetz

We are aware of this problem and apologize.  The fix for this should be released by Wednesday the 28th of September.  I can't guarantee the date, but hopefully it's sooner rather than later.

 

Again, apologies.

All Answers

sherodsherod

We had this issue yesterday, its down to the Winter 12 release I think.

 

The UserInfo.SessionID doesn't work, you need to use $API.Session_id from within Visualforce to get teh 'right' Session Id.  I'm unsure if thats a bug or a feature.

geosowgeosow

I'm experiencing a timeout because of this.  It is only happening in our Winter '12 full sandbox.  All is still good in our Summer '11 dev sandbox.  Ticket has been created with SFDC....

geosowgeosow

At SFDC Status all future maintenance windows have disappeared.  I'm assuming we're waiting for Winter '12.1 to get this issue fixed.

spraetzspraetz

We are aware of this problem and apologize.  The fix for this should be released by Wednesday the 28th of September.  I can't guarantee the date, but hopefully it's sooner rather than later.

 

Again, apologies.

This was selected as the best answer
MeetaGulatiMeetaGulati

Can we please know the work-around if Userinfo.getSessionId() is not bieng used in VF, but in the Apex classes itself for sending a request to an integrated service ? like in the original post from Hazem.

Hazem LotfyHazem Lotfy

here is what i did as a workaround, i passed the session as a parameter and in the constructor of the class i grabed the session like this:

session = ApexPages.currentPage().getParameters().get('session');

 

hope that helps

geosowgeosow

Our ticket was just marked as resolved.  We tested our Drawloop implementation in Winter '12 and everything is working like magic again. 

 

We couldn't use a workaround as we were not using visualforce, only apex.  We're continuing to test but so far so good!