tclsoft 发表于 2011-10-25 13:48:45

提示令牌失效,请修改服务器配置?

Option Explicit
Public U8_Login As U8Login.clsLogin
Sub UFLogin()
Dim sysLogin As Object
Set sysLogin = CreateObject("UFSoft.U8.Framework.Login.UI.clsLogin")
'Set sysLogin = CreateObject("UFSoft.U8.Framework.Login.UI")
'sysLogin.ShowLoginForm ("DP")
If sysLogin.Login_2("DP") = False Then
MsgBox sysLogin.ErrDescript, vbCritical, "登录"
End If
Set U8_Login = New U8Login.clsLogin
U8_Login.ClearError
Dim bLogin As Boolean
bLogin = U8_Login.ConstructLogin(sysLogin.userToken) 'U8_Login.Login("DP") '
'bLogin = U8_Login.Login("ST")
If Not bLogin Then
Unload Me
End If
End Sub
以上是登录代码,环境WIN2008SP2+SQL2008SP2+U8V10和WINXPSP3+SQL2000SP4+U8V10,两个环境下原用友都可以正常登录使用,调用却提示令牌失效,请修改服务器配置...

永生 发表于 2011-10-25 14:31:25

谢谢分享啊!!!!!!!!!!!!!!

sl198802 发表于 2011-11-5 22:07:58

谢谢分享啊!!!!!!!!!!!!!!

695543766 发表于 2011-11-15 09:30:54

我的也是这个问题,不知道楼主是否解决了

nhzhigang 发表于 2012-8-8 11:06:27

很好!谢谢分享!

tclsoft 发表于 2015-7-30 10:33:03

改用类模块方式
Option Explicit

Implements UFPortalProxyInterface.ILoginable

Public Property Get Business() As Object
    Set Business = g_obusiness
End Property

Public Property Set Business(ByRef bBus As Object)
    Set g_obusiness = bBus'获得business对象。
End Property

Private Function ILoginable_Login() As Boolean
    If ((Not g_obusiness Is Nothing) And g_bLogined = False) Then
      Set g_oLogin = g_obusiness.GetVBclsLogin() '获得login对象
      
      If UFSystem.State = 1 Then UFSystem.Close
      UFSystem.ConnectionString = g_oLogin.UfSystemADODb
      UFSystem.CursorLocation = adUseClient
      UFSystem.Open
      If UFData.State = 1 Then UFData.Close
      UFData.ConnectionString = g_oLogin.UfDbName
      UFData.CursorLocation = adUseClient
      UFData.Open
      
      ZTCode = g_oLogin.cAcc_Id
      ZTName = g_oLogin.cAccName
      
      pUserCode = g_oLogin.cAuditor.AuditorId
      pUserName = g_oLogin.cAuditor.AuditorName
      
      pUFDate = g_oLogin.CurDate
      
      g_bLogined = True
      ILoginable_Login = True
    Else
      ILoginable_Login = Not g_obusiness Is Nothing
    End If
End Function

Private Function ILoginable_LogOff() As Boolean
    '程序退出前,添加自己的代码
    ILoginable_LogOff = True '本行代码必须。
    g_bLogined = False '本行代码必须。
End Function

Private Function ILoginable_CallFunction(ByVal cMenuId As String, ByVal cMenuName As String, ByVal cAuthID As String, ByVal cCmdLine As String) As Object
    Dim vfd As Object
    Dim cSqlStr As String
   
    cSqlStr = "if object_id('TableHead') is null CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (50) NOT NULL , (50) NOT NULL , NOT NULL , NOT NULL CONSTRAINT DEFAULT (0), NULL , NULL ,CONSTRAINT PRIMARY KEYCLUSTERED ()ON ) ON "
    UFData.Execute (cSqlStr)

    cSqlStr = "if object_id('TableStyle') is null CREATE TABLE ( (50) NOT NULL , NULL , NULL , NULL , NULL , NOT NULL , NOT NULL , NOT NULL , NOT NULL , NOT NULL , (50) NULL , (50) NULL , (50) NULL , NOT NULL , (50) NULL , (20) NULL , (50) NULL , NULL , NOT NULL , NULL , NULL , NOT NULL , NULL , NULL,FixedCols int,CONSTRAINT PRIMARY KEYCLUSTERED () ON ) ON "
    UFData.Execute (cSqlStr)
   
    cSqlStr = " if object_id('UA_U8InterfaceSN') is null CREATE TABLE ( (150) NULL , (40) NULL, NULL, NULL)"
    UFSystem.Execute (cSqlStr)
   
    bSN = SNPeriod()
   

    If Not (g_obusiness Is Nothing) Then
      If cMenuId <> "SY0001" Then
            If bSN = False Then
                Exit Function
            End If
      End If
      Select Case cMenuId
      Case "SY0001"
            Set vfd = g_obusiness.CreateFormEnv("frmSN_key", frmSN) 'frmBom_key为任意字符串,建议以"窗体名_key"来表示,既防止重复,又清晰易懂。
            Call g_obusiness.ShowForm(frmSN, "DP", "frmSN_key", False, True, vfd)
      Case "SY0002"
            Set vfd = g_obusiness.CreateFormEnv("frmBomInv_key", frmBomInv) 'frmBom_key为任意字符串,建议以"窗体名_key"来表示,既防止重复,又清晰易懂。
            Call g_obusiness.ShowForm(frmBomInv, "DP", "frmBomInv_key", False, True, vfd)
      Case Else
            MsgBox "错误配置菜单!", vbInformation, "插件安装"
      End Select
    End If
End Function
以上是基本类的一些代码
页: [1]
查看完整版本: 提示令牌失效,请修改服务器配置?