I'd like to generate a link to an adminhtml page from within a script in my html directory.
I have read this question on Stackoverflow: Magento: generating url for a backend action (with key)
This works for me if I generate such a key from within an extension controller. The key generated from within my html directory script however does not work correctly and throws me to the dashboard when applied.
Edit: The redirect works 100% if the user is not logged in - i.e it directs the user to my module page 100% accurately.
However, if the user is already logged in, it redirects them to the dashboard due to the conflicting session.
I believe I need to somehow "switch" sessions, but I haven't managed to do so yet. I have taken a look at this post:
Check if Admin is Logged in Within Observer
Unfortunately it still redirects to the dashboard.
Any ideas?
frontendandadminsession are two different things :-/ What you might do is to fetch a link via AJAX to update the session with the secret key and then use this link, so the key is saved in the correct session (if your AJAX request goes to a adminhtml controller!) – Fabian Blechschmidt Mar 07 '14 at 12:30