Getting by Without $$WebQuerySave Event in a Custom Login Form

We had a need to do kick off an agent upon submission of our custom login form (normally in a $$WebQuerySave event). The agent does lookups and drops cookies on the user's machine once they authenticate with Domino. Since $$WebQuerySave events are not supported with custom login forms we found the following way to get around it:

When the form loads, it is automatically redirected to a login agent that sits in a secure database. The code to redirect the page is hidden if the agent has already been called (determined through the RedirectTo field). This will result in the user logging in to use the agent and then continuing on to the agent to drop the cookie. The agent will then redirect the user to the secure URL they were trying to go to in the first place. This all happens in a second.

In passthrough HTML on the top of the form:

<head><meta http-equiv="Refresh" content="0 url=/yourpath/yourdatabase.nsf/AgentName?OpenAgent&RedirectTo=FIELD(d_RedirectTo)FIELD"></head>

The code has a hide-when value of:
@Contains(RedirectTo; "AgentName?OpenAgent")

The "FIELD" represents the actual field, "d_RedirectTo" which has a computed for display value of the RedirectTo field. (Domino will populate this field with the URL the user was trying to get to before prompted to login.

The redirection code will now put the URL the user was trying to reach in the query string after "&RedirectTo=". Before finished running, the agent will parse the query string and redirect the user with the following code:

Dim session As New NotesSession
Dim db As notesdatabase
Dim doc As NotesDocument
Set doc=session.documentcontext
returnto = Evaluate ({ @Right ("} & qStr$ & {"; "&ReturnUrl=") } )
Print "<HTML><HEAD>"
Print "<SCRIPT LANGUAGE=""JavaScript"">"
Print " self.location.href='" + returnto(0) + "'" Print "</SCRIPT></HEAD>"

One more thing! Make sure you allow anyone allowed to log in to run this agent. Putting "*/YourCompany" as Reader in the ACL will be good enough.


This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.