You need to sign in to do that
Don't have an account?

Visualforce Page forces user to relogin the first time it loads
Hi all and thanks for taking the time to look at my post. I have a vf page that is restricted to logged in users, but for some reason the first time I navigate to it it always makes me login, even when I am already logged in to salesforce. Does anyone have any idea why? Thanks!
That's fine. You shouldn't have to redo your controller. But you do need to update the page to reference the standard controller for the object where you want to display the button (ie Contact, Account, Lead, ect).
For example:
Then, in your controller, add a new constructor as follows:
Full help guide here
This will minimize the amount of code you have to change (should be very little) AND enable your custom button on the standard page layout.
All Answers
It shouldn't. Can you post your code or the most relevant snippet? Is this part of a Force.com Site? How do you access the page? Web Tab? Custom Button? Please elaborate.
I'm using the page with the url myvisualforcehost/apex/page_name, when logged in to my regular salesforce instance. I'm still developing the page, so I just enter the url into the address bar.
When you are logged in, can you simply edit the URL as follows?
Let's say you are on the home page: https://na7.salesforce.com/home/home.jsp. Now edit it to point to the visualforce page like so:
https://na1.salesforce.com/apex/page_name. That should redirect you to the visualforce domain/apex/page_name and it should not require re-authentication. Let me know if that works.
Thank you, yes that does work. But will that work for my users when I create a button?
Are you creating a custom button on a standard page layout? Or a visualforce page that has a button to redirect the user to this page?
If custom button on standard page layout, make sure your VF page uses the standard controller. That will enable you to create a custom button, point it to your page, and put it on the page layout. You can use controller extensions to then extend the logic and functionality.
If it is a button on a vf page, make sure the PageReference is something like Page.page_Name. You don't need to hardcode the full url anywhere.
Thank you so much for your time and patience.
I want to be able to add a custom button on a standard page layout. I have already put a lot of time and effort into the custom controller for this vf page, and I think it needs to be one because I am displaying/editing values from a couple of sObjects on the same page. Is there any other way?
That's fine. You shouldn't have to redo your controller. But you do need to update the page to reference the standard controller for the object where you want to display the button (ie Contact, Account, Lead, ect).
For example:
Then, in your controller, add a new constructor as follows:
Full help guide here
This will minimize the amount of code you have to change (should be very little) AND enable your custom button on the standard page layout.
"<span class="keyword">public</span> myControllerExtension(ApexPages.StandardController stdController<span class="delimiter">)</span> <span class="delimiter">{</span>
<span class="statement">this</span>.acct <span class="operator">=</span> (Account)stdController.getRecord();
<span class="delimiter">}</span>"
Supposed to be in the visual force page or the Component Controller .js file? Sorry for ignorance I am still not fully aware of the terminology that what exactly is the "Controller" that you refer to.
I have visualforce page and standardcontroller to case. Now for some reason in Mozilla it always even on desktop redirects to salesforce1 and user is requested to relogin for opening a page with the vfpage.