+ Start a Discussion
Nikhil BanaitNikhil Banait 

How can I get the base URL in site?

Tried the methods available in given link but it returns the site URL instead of salesforce URL.
Example: I want to access salesforce base URL (https://cs13.salesforce.com) on site http://xyz.force.com/

How can I achieve this?
Any help will be appreciated.

This will return https://cs13.salesforce.com

Nikhil BanaitNikhil Banait
Already tried URL.getSalesforceBaseUrl().toExternalForm(); , but it returns the site URL(http://xyz.force.com/).
I am inserting the contact into saleforce from site. 
To give inserted contact URL(record URL) to admin via mail, I want salesforce base URL. 
Ken KoellnerKen Koellner
Look up the Site Class in the Apex coding manual.  It has a bunch of methods like Site.getBaseUrl().