Unable to open database on remote server from web agent

I can get this to work for manual agents, as well as scheduled agents, but so far not with web agents.

I have updated the “Trusted Servers” fields in the server documents of both the source and target servers with both server names. Both servers were restarted.

here is the code:

Set s=New notessession

Set db=s.currentdatabase

Set server=New notesname(db.server)

Set prof=db.getview(“DBProfiles”).getdocumentbykey(“DBProfile”,True)

Set con=s.DocumentContext

contenttype=Evaluate({@Middle(Query_String_Decoded+“&”;“type=”;“&”)},con)

Msgbox ("Using " & prof.ContentMgmtTargetServer(0))

Set targetdb = New NotesDatabase( “”, “” )

Call targetdb.Open( prof.ContentMgmtTargetServer(0), “mydatabase.nsf”)

If Not (targetdb.IsOpen) Then

Msgbox("Failed to open target database")

Exit Sub

End If

Subject: Unable to open database on remote server from web agent

Are you basing the thought that the database is not opening on the fact that you’re not getting a popup? Because you won’t that way in a web agent - Msgbox is a front-end object, and cannot be used in web agents. You can use javascript alerts, or just use the Print statement to print debugging code to your browser window.

Subject: Unable to open database on remote server from web agent

How do you know it did not work? There are tips on debugging web agents in the Agent FAQ. I prefer using ‘agent log’ (sample code included), for MessageBox you nede to be looking at the server console for the output.

If you used Trusted Servers and your agent signers have the rights to run agents it should work. Make sure you agent runs first without referencing remote server if you have problems. “Troubleshooting agents in R6” is the article in the Agent FAQ that should help.

Subject: RE: Unable to open database on remote server from web agent

Hi Julie, I have read all your articles with great interest but I think this problem may be compounded by the target database being located outside the firewall (in the dmz). The agent works fine between all the servers inside the firewall

Subject: SOLVED!

A port in the firewall must be opened to the requesting Domino server - D’oh!