I have two customer portals say A and B. When i log in into any one of the customer portal, In my apex class i want to identify for which portal i am logged in. Is it possible to identify for which portal you are logged in? If yes, How can i implement this?
I think you can use the Site methods for this: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm
I don't have the correct setup available currently to replicate this.
Three options that are a bit unorthodox but potentially could do the trick.
In some cases if the two portals do not share common profiles then that may be a way to distinguish which one they are logged into.
Another option that comes to mind (that I can't verify since I don't have a portal handy) is to look at the current URL and see if there are any differences when a user is logged onto one vs. the other and determine it that way. https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm
- Last would be to place a cookie on the home page of each respective portal and write the portal name in there so you can reference it later when needed. https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites_cookie.htm