<html> <head> <TITLE>session.asp</TITLE> <script id=clientEventHandlersVBS language=vbscript> Dim UserName Dim Password UserName=request.querystring("UserName") Passowod=request.querystring("Password") if Name="kkk" and Password="000" Call Session end if Sub Session Dim obj1 Dim objProp Set obj1 = CreateObject("rtxclient.rtxapi") Set objProp = obj1.GetObject("Property") objProp.Value("RTXUsername") = UserName objProp.Value("LoginSessionKey") =GetSessionKey()
objProp.Value("ServerAddress") = "192.168.1.201" objProp.Value("ServerPort") = 8000 obj1.Call 2, objProp End Sub
Private Function GetSessionKey() As String Dim objsvrAPI As RTXServerApi.RTXServerApi Dim objProp As RTXServerApi.IRTXParams Dim objSys As RTXServerApi.IRTXObject Set objsvrAPI = CreateObject("RTXServer.RTXAPI") Set objProp = objsvrAPI.GetObject("Property") Set objSys = objsvrAPI.GetObject("SysTools") objProp.Value("UserName") = UserName On Error GoTo ProcedureName_Err GetSessionKey = objSys.Call(&H2000, objProp) ProcedureName_Err: If Err.Description <> "" Then MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description Err.Clear End If Set objSys = Nothing Set objProp = Nothing Set objsvrAPI = Nothing End Function
</script> </head> <form> UserName:<INPUT UserName="UserName" MaxLength=20><p> Password:<INPUT Password="Password" MaxLength=20><p> <INPUT TYPE=submit><INPUT TYPE=reset> </form> </body> </html> 这段程序的作用是通过门户网站登陆时,如登陆正确则把用户名发到RTX服务器,以获得“SessionKey”,并通过用户名和“SessionKey”自动登陆RTX客户端(RTX客户端用户名和门户网站用户名相同)。 作为测试,我的本意是当输入的用户名为“kkk”密码为“000”时,则调用Session 过程,Session过程再调用GetSessionKey()来获得sessionkey,最后实现RTX客户端的登陆。可是运行后一直都没有反应,我是个初学者,请高手们多多帮助。谢谢!!