I figured out how to make Form-based Authentication use the form-error page to login and thought I would share with everyone. The instructions are iPlanet-specific, but can most likely be ported to another appserver, providing you knew the name of the hidden field that holds the url that the user is trying to access (represented as ias_auth_url_pattern in this example).
Basically, here is what I did: 1. Grab some values on the form-login page, the form's action (for talking to container's LDAP) and ias_auth_url_pattern (which holds the URL the user was trying to reach). 2. Setting these values as cookies using setCookie method )at the bottom of this post). <code> setCookie("authenticationUrl",document.formLoginForm.action.toString(),null, "/"); setCookie("ias_auth_url_pattern",document.formLoginForm.ias_auth_url_pattern .value,null,"/"); </code> 3. If an error occurs, on the form-error page (using the same form as on form-login page, with an empty action, action="") grab the values of the cookies using getCookie and populate the form's action and hidden field ias_auth_url_pattern. <code> var formAction = getCookie("authenticationUrl"); document.forms["formLoginForm"].action = formAction; // Get the URL that the user was trying to access, and set as a hidden variable // in the page var urlToAccess = getCookie("ias_auth_url_pattern"); document.forms["formLoginForm"].ias_auth_url_pattern.value = urlToAccess; </code> 4. Allow the user to login again from the form-error page! Hope this helps everyone utilize form-based authentication easier! Thanks, Matt ---------------------------------------------------------------------------- ----- javascript functions used for cookies: ---------------------------------------------------------------------------- ----- // Here's a nice function to set cookies. function setCookie(name,value,expires,path,domain,secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } // Here's a nice function to get cookies. function getCookie(name) { var prefix = name + "=" var start = document.cookie.indexOf(prefix) if (start==-1) { return null; } var end = document.cookie.indexOf(";", start+prefix.length) if (end==-1) { end=document.cookie.length; } var value=document.cookie.substring(start+prefix.length, end) return unescape(value); } // Here's a nice function for deleting cookies. function deleteCookie (name,path,domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com