清单 1.0
<WebMethod(EnableSession:=True)>
_
Public Function Login(ByVal UserId As String, ByVal Pwd
As String) As Boolean
If UserId = "test"
And Pwd = "test" Then
Session("Authenticated") = True
Me.TestMethod()
Return
True
Else
Return
False
End If
End Function
<WebMethod(EnableSession:=True)> Public Sub
TestMethod()
If
Session("Authenticated") Is Nothing Then
Throw
New Exception("Web service consumer is not _
authenticated")
End If
'... execute Web method code
End Sub