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ℜdirectTo=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 "ℜdirectTo=". 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$ & {"; "ℜturnUrl=") } )
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

Dig deeper on Domino Resources



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:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...