使用EnableSession访问session变量

ZDNet软件频道 时间:2003-02-13 作者:Techmail 代码页 |  我要评论()
本文关键词:

清单 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

百度大联盟认证黄金会员Copyright© 1997- CNET Networks 版权所有。 ZDNet 是CNET Networks公司注册服务商标。
中华人民共和国电信与信息服务业务经营许可证编号:京ICP证010391号 京ICP备09041801号-159
京公网安备:1101082134