View Single Post
  #1 (permalink)  
Old March 22nd, 2008, 12:51 AM
kate2008 kate2008 is offline
Registered User
Join Date: Mar 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 13:The test for RegistryPermissions failed

Why the objLog.WriteEntry are always successful???
================================================== ==============
Private Sub btnTestRegistryPermissions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestRegistryPermissions.Click
        Dim oRp As New RegistryPermission(Security.Permissions.Permission State.Unrestricted)
        Dim objLog As New EventLog
        Dim objLogEntryType As EventLogEntryType
            Throw (New EntryPointNotFoundException)
        Catch objA As System.EntryPointNotFoundException
                If Not System.Diagnostics.EventLog.SourceExists("Example" ) Then
                    System.Diagnostics.EventLog.CreateEventSource("Exa mple", "System")
                End If
                objLog.Source = "Example"
                objLog.Log = "System"
                objLogEntryType = EventLogEntryType.Information
                objLog.WriteEntry("Error: " & objA.Message, objLogEntryType)
            Catch objB As System.Exception
            End Try
        End Try
    End Sub
================================================== ==
Why the objLog.WriteEntry are always successful???