[SalesForce] making visual force page public-> not working (authorization error)

I have 2 visualforce pages :

  • refugee_main_tfi
  • refugee_dash_tfi

To make them available to public ( without salesforce login ) I have created a site and added these pages through "Enable Visualforce Page Access" to site.

now when i access the site I face two issues: http://tfifellows-refugeetransition.cs17.force.com/tfihome

  1. my static resources are not loaded. ( logo image is missing)
  2. The second page after redirect from the first gives me
    "Authorization error" –>
    http://tfifellows-refugeetransition.cs17.force.com/tfihome/refugee_dash_tfi?Id=003g000000X2CwhAAF
    ( this is how the url looks after redirect)

This is snippet of my controller for first page that redirects to the second. First page is accessible but not the second (authorization error)

// if validated everything, redirect to detail page for found HBT ID
            String strNewUrl = '/apex/refugee_dash_tfi?Id=' + lstContacts[0].Id;
            PageReference pr = new PageReference (strNewUrl);
            pr.setRedirect (true);
            return pr;

I am new to salesforce and trying to build a site from where contacts can edit objects related to them.
Any guidance will be highly appreciated.

Best Answer

Well I am posting this answer so that if someone novice like me is stuck ,it might help :

I posted two issues:
Issue 1: my static resources are not loaded. ( logo image is missing) --> was solved by the comment from @Eric I simply needed to make the static resaurces public.

Issue 2: "Authorization error" It turns out that guest user ( a user without login ) for sites can not edit "Standard Objects" although they can edit Custom objects . Since i was using standardController I was getting the authorization error. ref : https://developer.salesforce.com/page/Authenticating_Users_on_Force.com_Sites (The last 2 paragraphs before the "custom portal topic") .

The work around has been explained very nicely in this reply here by @Peter Knolle :

Workarounds for Sites page to update standard object?