hi,
I have a sub(on an AS400) in a script library that write data to a file on a web IIS server. This sub works perfectly with a Notes client but doesn’t work as soon as it is called from a web page. Is there a particular way to do it on the web ?
here is ma code :
Dim fileNum As Integer
Dim fileName As String
Dim sDate As String
fileNum% = Freefile()
fileName$ = “\servername\dir1\dir2\intradev\MajNews.txt”
sDate = Right(“0”&Day(Date),2) & “.” & Right(“0”&Month(Date),2) & “.” & Year(Date())
Open fileName$ For Output As fileNum%
Write #fileNum%, sDate
Close fileNum%
any idea ?
thanks
vince
Subject: write file in web
You need to store the agent as a agent in the database, and call it from the WebQueryOpen event on your Form. Note also that the file will be created locally on the server, so you might need to change the filename$ string, for example to: filename$=“c:\dir1\dir2\intratrade\MajNews.txt”.
Subject: RE: write file in web
hi,
thank for the advise.
I put the code in an agent call from the webquerysave. the browser returned “Agent done” but data didn’t change in the file. The matter is that i can’t change the path of the destination file and i can’t load it on the Notes Server.
i think my problem comes from the path but i don’t know what to do to solve it.
vince
Subject: RE: write file in web
Hi,
When you run the code as a webquerysave it will run on the server. Can the
server map to “\servername\dir1\dir2\intradev\MajNews.txt” ok ?
You may also want to put some error handling in your code so that you can trap
the error. This may give a clue as to the cause of the problem.
Regards
Ethann Castell
font color=“#FF7700”>Caliton Innovations
www.caliton.com]
Subject: RE: write file in web
hi,
Thanks, i guess the server can map the directory cause the agent works well with the Client but doesn’t work when it is called from a web page.
i will try to catch errors
regards
vince
Subject: RE: write file in web
To be able to write to file system on the server you have to have high (very high) security rights. You probably don’t have them and your calls are getting errors.
Subject: RE: write file in web
When you run the agent from your Notes Client, it uses your NT username to authenticate with the server for the filename$ path.
When the agent is run by the server (as scheduled agent for example, or as WebQueryOpen agent from the web), it will use the NT username of the session under which the server runs (if Domino runs as foreground application), or some System internal NT username if Domino runs as service (I’m not sure of the logic which NT username is applied when Domino runs as service, that’s why I never run Domino as a service. And I have absolutely no clue how OS/400 vs NT usernames are applied when running Domino on AS/400, it probably doesn’t even have the concept of “service” and “foreground application”).
When the NT username rights are OK, you need to check the agent’s execution rights, if your agent does File System operations, the option “2. Allow restricted operations” is the best choice, as option “3. Allow restricted operations with full administration rights” is not meant for normal use, as it breaks all Readers field functionality, and thus causes agents of applications to fail which are depending on those rights - your agent might just find documents which the agent signer is not supposed to see, not only because of security issues, but also as part of the application logic and functionality.
Subject: RE: write file in web
Thanks for your explaination.
I m sure that is a problem of right settings there is the error message from the server log.
07/29/2005 07:41:27 Agent ‘wDateMAJ’ error: Unable to open file
I m not realy sure that an agent running on as400 server can write in a file store on a win2000 server.
Subject: RE: write file in web
Maybe you could try to make an identical username and password on the NT server where the file resides, as the username and password of the AS/400 Domino account.
Subject: RE: write file in web
hi,
indeed, this already done, the agent runs with my account on each server.
bye
vince