SharePoint自帶WebService(Authentication Web Service)

  該Services的作用是用來驗證用戶的登陸

  引用地址  http://<Site>/_vti_bin/Authentication.asmx

 

  說下Authentication.Login Method 的使用

 

  Visual Basic (Usage)

Dim instance As Authentication
Dim username As String
Dim password As String
Dim returnValue As LoginResult

returnValue = instance.Login(username, password)

 

 

  1.  Public Function Logon(ByVal SharePointHost As StringByVal username As StringByVal password As StringByRef mycookieContainer As System.Net.CookieContainer) As Boolean Implements SPInferface.Logon
  2.         Dim Au As New Authentication.Authentication()
  3.         Au.CookieContainer = New CookieContainer()
  4.         Au.Url = SharePointHost & "/" & AuthenticationServiceName
  1.         Dim LoginResu As New Authentication.LoginResult()
  2.         Try
  3.             LoginResu = Au.Login(username, password)
  4.         Catch ex As Exception
  5.             Return False
  6.         End Try
  7.         If LoginResu.ErrorCode = Authentication.LoginErrorCode.NoError Then
  8.             mycookieContainer = Au.CookieContainer
  9.             Return True
  10.         End If
  11.         Return False
  12.     End Function

 

這裏如果登陸成功的話,會有一個byref的參數返回到客戶端

 

Au.CookieContainer

 

改參數的作用就是調用其他 webservices的時候 將該參數賦予給其他webserivce的對象,這樣該對象就會具備剛剛登陸用戶的權限信息....

發佈了38 篇原創文章 · 獲贊 5 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章