PrepAway - Latest Free Exam Questions & Answers

You need to resolve the error

You create a Web Part that contains the following logging code. (Line numbers are included for
reference only.) 01Try 02 … 03Catch ex As Exception 04
05System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, (“Exception Information: ” +
ex.Message), EventLogEntryType.Error) 06End Try You discover that line 05 causes an error.
You need to resolve the error. What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Add the following code at line 04 If web.CurrentUser.IsSiteAdmin = False Then
System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, “Exception Information: ” &
ex.Message, EventLogEntryType.[Error]) End If

B.
Change line 05 to the following code segment.
System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, “Exception Information”,
EventLogEntryType.Error)

C.
Add the following code at line 04. If web.CurrentUser.IsSiteAuditor = False Then
System.Diagnostics.EventLog.WriteEntry(“WebPart Name”, “Exception Information: ” &
ex.Message, EventLogEntryType.[Error]) End If

D.
Run the code segment at line 05 inside a RunWithElevatedPrivileges delegate.


Leave a Reply