Ns internalredirect

From AOLserver Wiki
Jump to navigation Jump to search


ns_internaledirect - Re-authorize and restart url processing (new in AOLserver 4.5)


ns_internaledirect ?connid? url


The ns_internalredirect command enables re-authorization and restart of a connection as if it were originally for a different URL. It is possible now to set new request url and re-process the request from the beginning without using external redirect. Internal redirect assigns new url and calls registered proc for new url inside the existing connection and using the same Tcl interpreter with all the same global variables, database handles, etc. still available.
The optional connid parameter is deprecated and should not be used.
The url should NOT have the http://host location, just the url portion starting with a /.


The script does not end at the time this command is invoked. When used in an adp page, ns_adp_abort or ns_adp_return should be called to end script processing after ns_internalredirect.
While nsperms request authorization always happens on the new url, neither preauth, nor postauth filters are executed. In the future, this command may be enhanced with the option to bypass authorization.
After executing the target url (whether it's an adp page or a registered procedure), control returns to the caller of this command but ns_conn url will continue to report the url passed to ns_internalredirect. Trace filters will also fire for this new url and so the access log will reflect the new url, not the originally requested one.
One thing to keep in mind about ns_internalredirect is the browser retains the url to which it posted, which is sometimes undesireable because you don't want it bookmarked or you don't want a refresh to resubmit the POST. In such scenarios an actual ns_returnredirect is more appropriate.


   ns_internalredirect /errorpage.adp


ns_return, ns_returnadminnotice, ns_returnbadrequest, ns_returnerror, ns_returnfile, ns_returnforbidden, ns_returnfp, ns_returnnotfound, ns_returnnotice, ns_returnok, ns_returnunauthorized, ns_returnmoved, ns_internalredirect