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
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.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm
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.
Elie.RodrigueElie.Rodrigue
URL.getSalesforceBaseUrl().toExternalForm();

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().