⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webserviceauthenticationevent.vb

📁 This is a book about vb.you could learn this from this book
💻 VB
字号:
Imports System
Imports System.Web
Imports System.Security.Principal

Namespace Microsoft.WebServices.Security

    Public Class WebServiceAuthenticationEvent
        Inherits EventArgs

        Private _IPrincipalUser As IPrincipal
        Private _Context As HttpContext
        Private _User As String
        Private _Password As String

        Public Sub New(ByVal context As HttpContext)
            _Context = context
        End Sub

        Public Sub New(ByVal context As HttpContext, ByVal user As String, ByVal password As String)
            _Context = context
            _User = user
            _Password = password
        End Sub


        Public ReadOnly Property Context() As HttpContext
            Get
                Return _Context
            End Get
        End Property

        Public Property Principal() As IPrincipal
            Get
                Return _IPrincipalUser
            End Get
            Set(ByVal Value As IPrincipal)
                _IPrincipalUser = Value
            End Set
        End Property

        Public Sub Authenticate()
            Dim i As New GenericIdentity(User)
            Dim roles() As String
            Dim Principal As New GenericPrincipal(i, roles)
        End Sub

        Public Sub Authenticate(ByVal roles() As String)
            Dim i As New GenericIdentity(User)
            Dim Principal As New GenericPrincipal(i, roles)
        End Sub

        Public Property User() As String
            Get
                Return _User
            End Get
            Set(ByVal Value As String)
                _User = Value
            End Set
        End Property

        Public Property Password() As String
            Get
                Return _Password
            End Get
            Set(ByVal Value As String)
                _Password = Value
            End Set
        End Property

        Public ReadOnly Property HasCredentials() As Boolean
            Get
                If ((_User Is Nothing) Or (_Password Is Nothing)) Then
                    Return False
                End If
                Return True
            End Get
        End Property
    End Class
End Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -