[MarkLogic Dev General] Redirect To login then Back to Required
dsewell at virginia.edu
Wed Oct 10 06:53:11 PDT 2007
On Wed, 10 Oct 2007, Neil Bradley wrote:
> I am using application-level security and have created a login page. I have
> added code to the top of other pages to re-direct to the login page if the
> user is the default "nobody" user. But, if the login is successful, I then
> want to re-direct back to the page the user was trying to reach (including
> any parameters to the URL used in the attempt to get to that page).
> Is there any easy way to do this? I don't want to have to create new
> parameters to pass between my pages just to preserve this information if
There are a couple ways to do it.
1. In your login code, use
to fetch the value of the page from which the user came, then use that
value in the redirect.
2. Even better (as not all browsers send the Referer header you want):
in the code that redirects to the login script, set a session field
value (xdmp:set-session-field()) which can then be used by the login
script, with xdmp:get-session-field().
In either case, you may also need to use xdmp:get-request-field()
to fetch the URL parameters.
All these functions are documented at
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 801079, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: dsewell at virginia.edu Tel: +1 434 924 9973
More information about the General