+ Start a Discussion

List of limitations of Salesforce sites? Is HttpRequest() permitted?

Firstly I'm trying to find out if you can do an HttpRequest using Salesforce sites my code is:


        Http h = new Http();
        HttpRequest req = new HttpRequest();

 But I keep getting "Authorisation Required" appearing... do I need to set some other permissions?


Also is there a list of things you can't do with Salesforce Sites?






You would have to register the site you are trying to access in the remote site setting - see this article http://wiki.developerforce.com/page/Apex_Web_Services_and_Callouts

I had already done that and it still didn't work.
Andy BoettcherAndy Boettcher

Hit the "Preview as Admin" link from the Sites page to launch your Site with the ability to see errors.  Odds are there is something off in your code that is throwing an exception.




I can't use Preview as Admin as based on your permissions different information is displayed and the error doesn't occur running as admin.

Andy BoettcherAndy Boettcher

If you don't get the error as admin, the first thing I'd check is to see if you are referencing objects that you haven't assigned proper "Public Access Settings" to.