How to redirect Authorisation Form

Hi all,

I m having problem while opening a database which has anonymous no access.

I have written a lotus script which is in agent:-

            Dim session As New NotesSession

Dim db As NotesDatabase

Dim CompDb As NotesDatabase 

Dim doc As NotesDocument

Dim userdoc As NotesDocument 

Dim userview As NotesView 

Dim userDb As NotesDatabase 

Msgbox session.CommonUserName  '' This will return server Name, I would like to fetch current user Name how could I do it....

If session.CommonUserName ="Anonymous" Then

	Msgbox "Sorry You are anonymous user"

	Exit Sub

End If

Set userDb = New NotesDatabase("","User.nsf")

When agent read the last line it would return error User Anonymous can not user.nsf database

Because anonymous has no access.

Is there any way to if user is anonymous it redirect them to login page of domino directory…

What I m trying to do is first I am cheking current user if it is anonymoys then redirect to login page of domcfg.nsf…

How could i do it please help

One more thing if I user session.commonuserName it returns my serverName. how could it fetch user Name By Field? or there is some other method.

I will be very thankful to you if somebody help me.

With Regards,

Vikas K Sinha

Subject: How to redirect Authorisation Form

If a user is not authenticated yet (in other words: anonymous) he will always and automatically be redirected to the login form (custom defined through domcfg.nsf or standard), if he tries to access a resource that is not available to anonymous users.

So, why this agent and where would you intend to put it?

Also, look up the EffectiveUserName property and run agents as web user, if they should reflect the name of the user instead of server or signer.

Subject: RE: How to redirect Authorisation Form

Very Thanks for your kind support

my agent is accessible because it is in default database which has anonymous access but in agent as per my code i used

dim db as notesdatabase

set db = new notesdatabase(“”,“User.nsf”)

here trigger an error at server console.

HTTP Server: Agent ‘agshow’ error: User Anonymous can not open database User.nsf

That’s why I m trying to redirect. but if I use

@URLOpen(“http://serverName/user.nsf/test?OpenForm”);

I alway prompt to me for login and password.

but in agent it is not prompting anything only send error at console.

Subject: RE: How to redirect Authorisation Form

What is this agent supposed to do in the end? How do you call it? Why do you want to check, if the user is anonymous, if this is exactly what Domino does for you?

You can redirect to an HTTP resource using

print “[/your/url/goes/here]”

but you didn’t make clear yet, why you want to have an agent redirecting users somewhere. Also, you never redirect them to domcfg.nsf. That’s not how it is supposed to work.

Subject: RE: How to redirect Authorisation Form

Basically I have two databases 1. Company.nsf and Second is User.nsf

In User Database there is a form which use to create user detail for different user. The agent which is I m trying to triggered is in default database and it search the a document based on login user and create new copy of searched document and to Company.nsf database.

these two database company.nsf and User.nsf has no access to Anonymous where as Default has access to anonymous.

The Agent what i have written is :

           Dim session As New NotesSession

Dim db As NotesDatabase



Dim currDoc As NotesDocument



Dim CompDb As NotesDatabase ' Declare Company Database Object	



Dim userDb As NotesDatabase 

Dim userView As NotesView 

Dim userDoc As NotesDocument 





Set doc = session.DocumentContext	



Set userDb = New NotesDatabase("","User.nsf") '

Set userView = userDb.GetView("userDetails")

Set userDoc = userView.GetDocumentByKey(currDoc.Remote_User(0),True)

If userDoc Is Nothing Then

	

Else

	Set compDb = New NotesDatabase("","Company.nsf")

	Call userDoc.CopyToDatabase(compDb)	

End If

while executing it send error to consel User Anonymous can’t open database user.nsf

that’s why I wanted to first login the user and then perform this code taks.

thanks for your quick response and waiting for your kind response

Thanks & Regards,

Vikas

Subject: RE: How to redirect Authorisation Form

I’ll happily look into it as soon as I can see your architecture.

There is no such thing as “default database” in Domino terminology. Is this the database, that is accessed by your Home URL (in your server or web site document)? How is this agent called? Is the link to the ?OpenAgent command used as Home URL?

Subject: RE: How to redirect Authorisation Form

No-No…

I have created a database that’s name is default.nsf and it is used for my Home URL . You are absolutely right.

And I am triggring this agent on the click event of Hotspot Button. which is at form and that form and agent both are in Default.nsf database.

waiting for your valuable response

With Regards,

Vikas