Doclink problem in web

Hi all

I am sending doclink throug mail to the users. If the user is registered user for the site, the document should be open in right frame. If he is not registered yet then registration form should be open in right frame. For this, I have set right frame type as “URL” and my code is.

ret := @DbLookup( "" : "NoCache" ; "" : "" ; "RegProfiles" ;@UserName;1);

key:=@If(@iserror(ret);“HomePageConfigUnreg”;“HomePageConfig”);

“http://” + @GetHTTPHeader(“Host”) + “/” + @Text(@WebDbName) + “/HomePageSetup/” + @Text(key) + “?OpenDocument”

But, document is opening for un-registered users also.

This is designated frameset when open in web. When users try to open home page , it is working correctly.

     We are getting this problem with doclinks only. 

Can any one suggest the solution?

Thanks ,

G Pradeep Kumar